我有以下列表:jQuery的选择填写一个元素
<select id="selectprice" name="prod1">"
<option value="1">prod1</select>
<option value="2">prod2</select>
<option value="3">prod3</select>
</select>
<input type="text" id="valueprice" name="price_incl" size="4">
我想下面的代码,当我从下拉式选项来更新我的价格:
<script type="text/javascript">
$(document).ready(function() {
$("select[name='prod1']").change(function() {
if($(this).val()==1) {
$('#valueprice1').text("21.95");
}// ect ect
});
});
</script>
但..它不工作,我似乎无法找出原因;)
问候
'<选项值= “1”> PROD1'?应该是'' –
then'$('#valueprice')。val(“21.95”);'not'$('#valueprice')。text(“21.95”); ' –