Sunday, 15 September 2013

javascript - checkboxes behave like radiobuttons with different names -



javascript - checkboxes behave like radiobuttons with different names -

i have problem, might easy guys. im new in jquery , trying form (calculator) of selectboxes, checkboxes , 3 radiobuttons (with 3 same names, 1 or none can checkable).

when submit form (at first time), values of each inputs remain same wanted to. when submit sec time without refreshing/resetting, radiobutton checked before disappears , when reclick radiobutton without refreshing , submit it, value cant maintained php.

so decided alter radio buttons checkboxes, , need help.

i need 3 checkboxes can selected 1 or none of them different "names".

<input type="checkbox" id="checkbox8" value="1" name="8" <?php if(isset($_post['8']) && $_post['8'] == '1') echo 'checked="checked"';?> /> <input type="checkbox" id="checkbox9" value="2" name="9" <?php if(isset($_post['9']) && $_post['9'] == '2') echo 'checked="checked" ';?> /> <input type="checkbox" id="checkbox10" value="3" name="10" <?php if(isset($_post['10']) && $_post['10'] == '3') echo 'checked="checked" ';?> />

i prepared this:

[a link] (http://jsfiddle.net/ry4k8ve9/)

thanks lot in advance!! hope can help me

try this:-

var $unique = $('#checkbox8,#checkbox9,#checkbox10'); $unique.click(function() { $unique.not(this).removeattr('checked'); });

demo

javascript jquery checkbox radio

No comments:

Post a Comment