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><input type="radio" name="radio"> Checkbox 1</label>
<label><input type="radio" name="radio"> Checkbox 2</label>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="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

 <script type="text/javascript" src="jquery.js"></script>
 <script type="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>
        <script type="text/javascript" src="http://codeorigin.jquery.com/jquery-2.0.3.min.js"></script>
        <script type="text/javascript" src="http://www.digitss.com/jquery/jquery.radio.checkbox.behavior.js"></script>
    </head>
    <body>
        <label><input type="radio" name="radio"> Checkbox 1</label>
        <label><input type="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"