最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQuery select by input name - Stack Overflow

programmeradmin1浏览0评论

I have this input:

<tr><td class="forms">Price:</td><td><input type="text" name="price" size="30"/></td></tr>

How can I call this input?

Example: With this code I call to the id:

$("#numberclasses").change(function() {

And I call to the class with this:

$(".numberclasses").change(function() {

But How can I call to the name?

I have this input:

<tr><td class="forms">Price:</td><td><input type="text" name="price" size="30"/></td></tr>

How can I call this input?

Example: With this code I call to the id:

$("#numberclasses").change(function() {

And I call to the class with this:

$(".numberclasses").change(function() {

But How can I call to the name?

Share Improve this question edited Jan 21, 2013 at 17:38 Shomz 37.7k4 gold badges60 silver badges87 bronze badges asked Jan 21, 2013 at 17:36 carloscccarloscc 7994 gold badges16 silver badges21 bronze badges 3
  • what is numberclasses here? – Ravi Y Commented Jan 21, 2013 at 17:37
  • 2 @ryadavilli does it matter? – Shomz Commented Jan 21, 2013 at 17:39
  • 1 possible duplicate of How can I select an element by name with JQuery? – John Koerner Commented Jan 22, 2013 at 0:15
Add a comment  | 

1 Answer 1

Reset to default 17

Use:

$('input[name="price"]').change(function() {

Check out the jQuery selectors docs for more info.

发布评论

评论列表(0)

  1. 暂无评论