Button Submit on a form is not working jquery mobile -
on press of button, want alert 2 values in 2 inputs. however, not working, page redirects 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>
selector syntax incorrect.you forgot add #
(assuming selecting id
)
$('#newann').submit( function () { alert($('#t').val()); alert($('#m').val()); });
Comments
Post a Comment