當我只選擇第一個下拉菜單,結果#output顯示NaN?
http://jsfiddle.net/boyee007/TJcP4/
我想,如果選擇了第一個下拉列表中顯示30,然後如果這兩個選擇將計算這兩個值如何計算下拉值jQuery
<select id="t_dermal_name">
<option value="1" rel="30">Between Eyebrows</option>
<option value="7" rel="30">Individual Line Softening</option>
<option value="2" rel="30">Lip Contouring</option>
</select>
<select id="t_wrinkle_name">
<option value="1" rel="30">Between Eyebrows</option>
<option value="7" rel="30">Individual Line Softening</option>
<option value="2" rel="30">Lip Contouring</option>
</select>
var output = 0;
var output1 = 0;
if($("#t_dermal_name").val() != 0){
enter code here`output = $("#t_dermal_name").find('option:selected').attr('rel');
}
if($("#t_wrinkle_name").val() != 0){
output1 = $("#t_wrinkle_name").find('option:selected').attr('rel');
}
$("#output").html(parseInt(output) + parseInt(output1));
+1的問題,使用的jsfiddle像親 – gnarf