Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
379 views
in Technique[技术] by (71.8m points)

javascript - jQuery访问输入隐藏值(jQuery access input hidden value)

如何使用jQuery访问<input type="hidden">标签的value属性?

  ask by I-M-JM translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can access hidden fields' values with val() , just like you can do on any other input element:(您可以使用val()访问隐藏字段的值,就像您可以对任何其他输入元素执行操作一样:)

<input type="hidden" id="foo" name="zyx" value="bar" /> alert($('input#foo').val()); alert($('input[name=zyx]').val()); alert($('input[type=hidden]').val()); alert($(':hidden#foo').val()); alert($('input:hidden[name=zyx]').val()); Those all mean the same thing in this example.(在这个例子中,这些都意味着相同的事情。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...