Wednesday, 7 August 2013

Button Submit on a form is not working jquery mobile

Button Submit on a form is not working jquery mobile

On the press of the button, i want to alert the two values in the two
inputs. However, this is not working, the page just redirects to the main
page in jquery mobile.
JS
$('newann').submit( function () {
alert($('#t').val());
alert($('#m').val());
});
HTML
<form id="newann" name="newann">
<input type="text" id="t" placeholder="Title" />
<input type="text" id="m" placeholder="Add more..." />
<button type="submit" name="submit">Publish News</button>
</form>

No comments:

Post a Comment