我想打開一個選擇框顯示一個輸入框,當某些選項被選中。選擇框打開輸入框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