【发布时间】:2011-10-10 10:49:15
【问题描述】:
我想在我的页面上检测用户未更改其值的下拉列表。 为了这个目标,我正在尝试搜索仍然选择默认值的所有下拉列表。
var t = $("select[value='Select Team'] select:selected").attr("id");
alert(t);
警报是:'未定义'
HTML 代码:
<TMPL_LOOP DATA_ROLES>
<tr id="<TMPL_VAR ID>">
<td><select class="role2" id="role2_<TMPL_VAR ID>" name="role2_<TMPL_VAR ID>" title="The role of the employee"><TMPL_VAR ROLE></select></td>
<td><input class="steps" id="steps_<TMPL_VAR ID>" type="text" name="steps_<TMPL_VAR ID>" size="5" title="Total amount of steps per month" value="<TMPL_VAR STEP>"></td>
<td><input class="measurable_steps" id="measurable_steps_<TMPL_VAR ID>" type="text" name="measurable_steps_<TMPL_VAR ID>" title="Measurable steps" value="<TMPL_VAR MEASURABLE_STEP>"></td>
<td><input class="steps_ratio" id="steps_ratio_<TMPL_VAR ID>" type="text" name="steps_ratio_<TMPL_VAR ID>" title="'Measurable steps' / 'Steps'" value="<TMPL_VAR STEPS_RATIO>%" readonly></td>
<td style="text-align: center"><select class="reopen_rate" id="reopen_rate_<TMPL_VAR ID>" name="reopen_rate_<TMPL_VAR ID>" title="How many reopenes after closing the SI"><TMPL_VAR REOPEN></select></td>
<td><select class="w4p" id="w4p_<TMPL_VAR ID>" name="w4p_<TMPL_VAR ID>"><TMPL_VAR W4P></select></td>
<td><select class="team" id="team_<TMPL_VAR ID>" name="team2_<TMPL_VAR ID>"><TMPL_VAR TEAM></select></td>
<td><input class="checkbox" id="checkbox_<TMPL_VAR ID>" type=checkbox></td>
<td><input class="status2" id="status2_<TMPL_VAR ID>" type="hidden" name="status2_<TMPL_VAR ID>" value="<TMPL_VAR STATUS>"></td>
</tr>
</TMPL_LOOP>
你能帮忙吗?
谢谢!
【问题讨论】:
-
请你把你的
select标签的html放上去 -
你试过
select[value='Select Team']:selected -
您阅读我的回答有帮助吗?
-
不起作用 - 添加了 html...
-
我的情况如下:linkjsfiddle.net/BFMD4/3