Search

I'd like to have a form containing one select menu (to be used as a nav menu) to be inserted into the HTML via Javascript. However, this menu relies on the XML data and some XSLT.

How can I have the form inserted into HTML only if JavaScript is available?

Context: this form containing a select menu is intended to "replace" an unordered list for mobile browsers. Via media queries, I'm hiding either the form or the ul depending on viewport width. I only want it in the HTML if JavaScript is available because JavaScript is required to make it function and result in a new page load.

Thanks.

I've since realised that I can simply hide what I need to using CSS as Modernizr gives me 'js' and 'no-js' classes to play with, so this isn't a must-solve for me any more as I can cover both JavaScript and non-JavaScript users.

However, this does potentially leave those with JavaScript and CSS disabled with a useless, visible select menu, so I'd still be interested in any insights.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details