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
Post a Comment