Jump to content

How to check data inside field with a form and without jquery


Recommended Posts

Hello,

 

I am looking something allowing to check the number of character inside a textarea without jquery. There are some solution, but I like the code below because he is very short.

It's for some people want to do create a form as contact, feedback, reviews, comment ... It can be useful

If the number of character is not reach, a pop up appear on the screen.

 

  <form action="mango.php" method="post" id="form12" onsubmit="var text = document.getElementById('checkField').value; if(text.length < 80) { alert('put more info!'); return false; } return true;">
<textarea rows="10" cols="80" maxlength="200" required id="checkField" > </textarea>
</form>

 

  • Like 2
  • Thanks 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use