jQuery mobile: ajax form submission + disable enter key to submit form -
i trying learn bit of jquery mobile preparing little form , want disable enter key submit form.
here's tried:
$('#form').submit(function(e) { e.preventdefault(); // don't submit multiple times this.submit(); // use native submit method of form element $('#field').val(''); // blank input }); // validate , submit form $("#page").live("pageinit", function () { $("#form").validate({ submithandler: function(form) { // other stuff valid form $.post('insert.php', $("#form").serialize(), function(data) { $('#results').html(data);
but every time press enter form submitted anyway...
what doing wrong?
i've resolved way (i have no checkboxes in page):
$(document).bind('pageinit', function () { $('input,select').keypress(function(event) { return event.keycode != 13; }); });
Comments
Post a Comment