【发布时间】:2010-09-27 19:22:23
【问题描述】:
我有多个下拉菜单用于隐藏/显示表格中的行。
例子:
<select name="kp1_action" class="longboxsmall">
<option class="hidenextrow" value="">Button Disabled</option>
<option class="showtransferoptions" value="transfercall">Transfer Call + Log Keypress to Reports</option>
<option class="shownextrow" value="logkeypress">Log Keypress to Reports Only</option>
<option class="shownextrow" value="optout">Optout of Call List</option>
</select>
我已经为每个不同的选项分配了类,因此我可以在单击它们时触发事件,这是我的 jQUERY。
$(".shownextrow").click(function() {
$(this).closest("tr").next().show().find('.longboxsmall').hide();
});
$(".showtransferoptions").click(function() {
$(this).closest("tr").next().show().find('.longboxsmall').show();
});
$(".hidenextrow").click(function() {
$(this).closest("tr").next().hide().find('.longboxsmall').hide();
});
在 Firefox 中一切正常,但在 IE 或 CHROME 中却不行,这是为什么?有没有更好的方法来完成上述操作?
【问题讨论】:
标签: jquery drop-down-menu html-table cross-browser show-hide