Prevent users submitting contact form if less than 2 words are entered (JavaScript)


/ Published in: CSS
Save to your folder(s)

Prevent users submitting contact form if less than 2 words are entered (JavaScript)


Copy this code and paste it in your HTML
  1. $('#question_submit').click(function (e) {
  2. e.preventDefault();
  3.  
  4. if ($('#question_name').val().toString().split(' ').length > 2) {
  5. $('#new_question').submit();
  6. }
  7. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.