【发布时间】:2010-10-25 08:41:46
【问题描述】:
我似乎无法让这个工作看起来应该是这样的
$('.titleother').change(function() {
if ($('.titleother').val() == 'Other') {
$('.hiddentext').css('display','block')
}
})
对于这个 HTML
<select class="titleother">
<option value="1">1</option>
<option value="2">2</option>
<option value="Other">Other</option>
</select>
<p class="hiddentext" style="display:none">TEXT</p>
有什么想法吗?
【问题讨论】:
-
确定不是work?
-
它似乎不适合我?
-
代替 if ($('.titleother').val() == 'Other') $('.hiddentext').css('display','block')更好的方法是:$('.hiddentext').toggle($(this).val() == 'Other');