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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -