【发布时间】:2016-02-18 13:27:51
【问题描述】:
这是我的数组
$m3 = array
(
'2' => '2',
'4' => '4',
'6' => '6',
'9' => '9',
'14' => '14',
'18' => '18',
'20' => '20',
'other' => 'other'
);
如何让“其他”更改我在输入字段“其他兴趣”中输入的内容?
<?=$form->input('Car/m3', array('name' => "other_interest", 'style' => "display:none", 'class' => 'inputText', 'label' => false));?>
当我选择其他时,jQuery 会显示输入字段
<script>
jQuery(document).ready(function() {
jQuery("#CarM3").change(function() {
if (jQuery(this).val() === 'other'){
jQuery('input[name=other_interest]').show();
} else {
jQuery('input[name=other_interest]').hide();
}
});
});
</script>
【问题讨论】:
-
这是下拉列表的id