javascript - jQuery form submission -


my form works should , receive emails if hit submit without entering data error box informing of required fields - submit button stays greyed out, if fill in fields cannot submit form without refresh.

code:

jquery(document).ready(function() {     $('#success').hide();      $('#contactform').submit(function() {         var action = $(this).attr('action');          $('#contactform #submit').attr('disabled', 'disabled').after('<img src="images/ajax-loader.gif" class="loader" />');          $("#message").slideup(750,function() {             $('#message').hide();              $.post(action, {                  name: $('#name').val(),                 email: $('#email').val(),                 phone: $('#phone').val(),                 subject: $('#subject').val(),                 comments: $('#comments').val(),                 verify: $('#verify').val()             },             function(data) {                 document.getelementbyid('message').innerhtml = data;                 $('#message').slidedown('slow');                 $('#contactform img.loader').fadeout('fast',function(){$(this).remove()});                 $('#contactform #submit').attr('disabled','');                  if(data.match('success') != null) $('#submit').hide();              });         });          return false;      }); }); 

any appreciated!

this because disabled attribute works existence. mean inclusion of disabled attribute causes element disabled.

replace:

$('#contactform #submit').attr('disabled',''); 

with:

$('#contactform #submit').removeattr('disabled'); 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -