css selectors - jQuery check box question -
how can make 5th box work "checked" or "not checked"?
var price_1_startup = 800; var price_1 = 0; function upgrade_1(str) { if (str == 1) {price_1 = 0;} else if (str == 2) {price_1 = +125;} else if (str == 3) {price_1 = +200;} else if (str == 4) {price_1 = +325;} $("#price_1").hide().html(price_1_startup+price_1).fadein('slow'); } function checkbox() { $("#price_1").hide().html(price_1_startup+1500).fadein('slow'); }
<input type="radio" name="upgrade1" value="1" onclick="upgrade_1(this.value);" checked="checked" /><br> <input type="radio" name="upgrade1" value="2" onclick="upgrade_1(this.value);" /><br> <input type="radio" name="upgrade1" value="3" onclick="upgrade_1(this.value);" /><br> <input type="radio" name="upgrade1" value="4" onclick="upgrade_1(this.value);" /><br> <input type="checkbox" name="upgrade1" value="5" onclick="checkbox(this.value);" /><br>
jquery('input[value="5"]').attr('checked', true);
this check radio button value (1, 2, 3, 4)
var selected = parseint(jquery('input[type="radio"][name="upgrade1"]:checked').val());
Comments
Post a Comment