I don't know what's causing the <noscript>
problem, but I do know you're on the wrong track with that approach.
Look at the two versions of the input form—they are identical except for these differences:
- The scripted version adds
id
attributes on the<form>
and its elements. - The
<noscript>
version addsaction
andmethod
attributes to the<form>
, andrequired
attributes to several elements.
What you should do is have a single instance of this form and use it for both purposes. Add in all of the attributes from both versions of the form. The id
attributes won't hurt anything in the no-JS case, and the action
/method
and required
attributes won't hurt anything when you're handling the submission with JavaScript. (Just suppress the normal form submit with a .preventDefault()
call as usual.)
So the form ends up like this:
<form id="animate" action="process.php" method="post" >
<input id="name" name="Name" type="text" value=""
placeholder="Your Name" required="" maxlength="25">
<input id="email" name="Email" type="text" value=""
placeholder="Your E-mail" required="" maxlength="100">
<textarea id="Message" name="Message" placeholder="Your Message"
spellcheck="true" rows="6" required="">
</textarea>
<input id="spam" type="text" name="spam"
style="display: none;" value="">
<input id="submit" type="submit" name="submit" value="Submit">
</form>
Your page also has <h2>
and <h3>
tags in the <noscript>
section and the "Thank you" <div>
in the script version, but you can hide and show those as needed using techniques like the ones suggested in the other answers.