jQuery: trying to get the input value

爱⌒轻易说出口 提交于 2019-12-11 09:55:16

问题


i'm trying to obtain an input value with this:

var $a = ('#telephone_number').val();

alert($a);

But nothing, any idea?

telephone_number is the id of the input.

Regards

Javi


回答1:


use this

var $a = jQuery('#telephone_number').val();

OR

var $a = $('#telephone_number').val();



回答2:


   var $a = $('#telephone_number').val();

    alert($a);

currently you are not passing the div id to jQuery, u are just doing (#tel_no) this is wrong.



来源:https://stackoverflow.com/questions/3788910/jquery-trying-to-get-the-input-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!