Skip to content Skip to sidebar Skip to footer

Radio-button Act Like Checkbox

Here is my code: HTML:

Solution 1:

You have to include jQuery and the behaveLikeCheckbox plugin to make this work. Here is an updated fiddle: http://jsfiddle.net/mq8Zq/174/

So in your HTML document:

<label><inputtype="radio"name="radio"> Checkbox 1</label><label><inputtype="radio"name="radio"> Checkbox 2</label><scriptsrc="http://code.jquery.com/jquery-1.10.2.min.js"></script><scriptsrc="relative/path/to/plugin/or/cdn"></script><script>
  $(document).ready(function(){
     $(":radio").behaveLikeCheckbox();
  });
</script>

Solution 2:

sadly, that example page doesn't explain anything...

looking at the source code of the page, it seems that you have to include jquery and the extension for the behavior

<scripttype="text/javascript"src="jquery.js"></script><scripttype="text/javascript"src="jquery.radio.checkbox.behavior.js"></script>

Solution 3:

You need to include some JS files : JQuery, and the plugin for the checkbox. Like this :

<!doctype html><html><head><scripttype="text/javascript"src="http://codeorigin.jquery.com/jquery-2.0.3.min.js"></script><scripttype="text/javascript"src="http://www.digitss.com/jquery/jquery.radio.checkbox.behavior.js"></script></head><body><label><inputtype="radio"name="radio"> Checkbox 1</label><label><inputtype="radio"name="radio"> Checkbox 2</label><script>
            $(document).ready(function(){
                $(":radio").behaveLikeCheckbox();
            });
        </script></body></html>

Solution 4:

The only thing you have to do is put a different "name" to your Radios. When you put the same name to them, only one gets "selected".

Solution 5:

Make type="checkbox" and name Same

Post a Comment for "Radio-button Act Like Checkbox"