我似乎無法得到這個工作,我找不到任何錯誤。這裏是選擇選項:Jquery #div選項:選定的問題
<select id="elecspend">
<option selected="selected" value="month">Monthly Spend</option>
<option value="yearly">Yearly Spend</option>
<option value="quarterly">Quarterly Spend</option>
<option value="consumption">Yearly Consumption (kWh)</option>
</select>
<div class="consumptext">Enter your monthly spend in here: </div> <input style="width: 80px;" type="text">
這裏是jQuery的。
$(document).ready(function() {
$("#elecspend").change(function() {
if($("#elecspend option:selected").attr('value') == 'monthly') {
$(".consumptext").html("Please enter your monthly electricity spend");
}
});
});
感謝您的幫助球員。 Sam
您尚未描述所需的功能。 –