mardi 12 septembre 2017

How to connect dynamic checboxes with dropdown list in jQuery

You click checkbox, the same is selected on Select List/Drop-down List and reverse. You Select on Select list and checkbox is checked, only one in time selection.

<html>
<head>
    <script type="text/javascript" src="http://ift.tt/2nYZfvi"></script>
</head>
<body>
    <form>
    <h3>Select color</h3>
    <div id="checkboxes">
      <label for="red">
        <input type="checkbox" id="red" value="0" onclick="selColor(0);" >red</label>
      <label for="blue">
        <input type="checkbox" id="blue" value="1" onclick="selColor(1);" checked>blue</label>
      <label for="green">
        <input type="checkbox" id="green" value="2" onclick="selColor(2);" />green</label>
    </div>
    <div>
    <select name="selectColorList" id="selectList" onchange="selectChanged()">
    <option value="0">red</option>
    <option value="1" selected>blue</option>
    <option value="2">green</option>
    </select>
    </div>
    </form>
    <script>
        $(document).ready(function(){
            $("#checkboxes").

        }); 
    </script>
</body>
</html>




Aucun commentaire:

Enregistrer un commentaire