使用jQuery从隐藏字段中获取价值 [英] Get value from hidden field using jQuery
本文介绍了使用jQuery从隐藏字段中获取价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个<input type="hidden" value="" id='h_v' class='h_v'>
使用jQuery,我想提醒用户该值.
I have a <input type="hidden" value="" id='h_v' class='h_v'>
Using jQuery I want to alert the user to this value .
我正在使用
var hv = $('#h_v).text();
alert('x');
但是它不起作用,有任何线索!
But its not working, any clues!
推荐答案
改为使用 val()
的text()
var hv = $('#h_v').val();
alert(hv);
您遇到了以下问题:
- 单引号未关闭
- 您在输入字段中使用
text()
- 您回显的是
x
而不是变量hv
- Single quotes was not closed
- You were using
text()
for an input field - You were echoing
x
rather than variablehv
这篇关于使用jQuery从隐藏字段中获取价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文