【发布时间】:2013-06-14 20:51:26
【问题描述】:
我有一个如下所述的选择列表:
<select id="edit-type" class="form-select ajax-processed valid" name="type">
<option selected="selected" value="text">Text</option>
<option value="select">Drop Down List</option>
<option value="file">Single File Submission</option>
<option value="license">License</option>
</select>
我想使用 jQuery 来查找这个 select 元素,但我想使用 name 属性来查找它(而不是 id 或 class 属性,因为它们可能会改变)。我尝试了以下方法,但它不起作用:
$(':select[name="type"]').live('change', function() {....
我是 JavaScript 新手,所以我想我在这里遗漏了一些基本的东西。我以为这会奏效。我可以不使用:select[name="type"] 作为选择器吗?
【问题讨论】: