R
R
realfront2016-12-08 16:29:40
JavaScript
realfront, 2016-12-08 16:29:40

jquery form validation with hide button submit?

Is there a jquery plugin that validates the form and hides the submit button, if the validation fails, and if everything is fine, then submit opens.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
last_round, 2016-12-10
@last_round

In an HTML document:

<form action="">
  <input type="text" id="text">
  <input type="submit" id="submit" style="display:none;">
</form>

JavaScript (with jQ):
function validate(){
  if( $('#text').val() == 123 ){
    $('#submit').show();
  }else{
    $('#submit').hide();
  }
  }
  
  $('#text').keyup(function(){
    validate();
  });

Also you can write validation for e-mail || password || phone number, it is enough to pass the desired value to the function and process it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question