我想打开一个选择框显示一个输入框,当某些选项被选中。选择框打开输入框jQuery
这里是我的代码:
$("document").ready(function() {
$('input.other').hide();
$('#amount').change(function() {
// var val = $(this).find('option:selected').text();
//alert(val);
var selectedValue = $(this).find(":selected").val();
//alert(selectedValue);
if($(this).selectedValue == '25.00') {
// only if the radio button has a dob-field
$('input.other').show();// show only the following first
}
});
});
细说您的问题 – 2012-03-04 17:28:19
有在你的代码中的许多错误。它是'$(document).ready(function(){})'。它不是'if($(this).selectedValue == '25 .00')'but if(selectedValue == '25 .00')'...和'$('input.other')。show()'just否定你在第二行做的事。 – 2012-03-04 17:33:11
你可以尝试改写第一句话吗?目前的形式没有多大意义。 – 2012-03-04 18:16:15