javascript - Form will not submit with captcha -


i have used starting point form on website needs captcha, upon adding it, not submit action.php page move on user.

what can submit?

http://jsfiddle.net/swade/m5rvh/

<form id="form" action="action.php">     <input type="text" name="name" placeholder="name" />      <input type="submit" value="send" /> </form>  $(function(){      var mathenticate = {         bounds: {             lower: 5,             upper: 50         },         first: 0,         second: 0,         generate: function()         {             this.first = math.floor(math.random() * this.bounds.lower) + 1;             this.second = math.floor(math.random() * this.bounds.upper) + 1;         },         show: function()         {             return this.first + ' + ' + this.second;         },         solve: function()         {             return this.first + this.second;         }     };     mathenticate.generate();      var $auth = $('<input type="text" name="auth" />');     $auth         .attr('placeholder', mathenticate.show())         .insertafter('input[name="name"]');      $('#form').on('submit', function(e){         e.preventdefault();         if( $auth.val() != mathenticate.solve() )         {             alert('wrong answer!');         }     });  }); 

the default action form submit preventing. prevent it, if captcha doesn't match.

$('#form').on('submit', function(e){     if( $auth.val() != mathenticate.solve() )     {         e.preventdefault();         alert('wrong answer!');     } }); 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -