jquery - Alert box for `alert($('input:number[name=userNum]').val());` does not pop-up -


script(type='text/javascript', src='js/jquery.min.js') script.   function afunction() {   alert($('input:text[name=username]').val());  /* alert box, works fine. */   alert($('input:number[name=usernum]').val()); /* error here. alert box not pop-up */   }  body  form(name='aform', method='post', onsubmit='afunction();')    input(type='text', name='username', placeholder='enter name')    input(type='number', name='usernum', placeholder='enter number')    button(type='submit') submit 

the alert box pops name entered, alert box not pop number entered. error there?

for input type number, can use code like:

alert($('input[name=usernum]').val()); 

since, in jquery don't have selector number yet! though have selector :text.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -