html - Toggle jQuery Overlap -


i using button script jquery (source:https://jqueryui.com/button/#checkbox).

i have run in issue when using .toggle

  <!doctype html> <html lang="en"> <head>   <meta charset="utf-8">   <title>jquery ui button - checkboxes</title>   <link rel="stylesheet"     href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">   <script src="//code.jquery.com/jquery-1.10.2.js"></script>   <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>   <link rel="stylesheet" href="/resources/demos/style.css">    <style>   #format { margin-top: 2em; }   </style> </head> <body> <div id="format">   <input type="checkbox" id="check1"><label for="check1">option 1</label>   <input type="checkbox" id="check2"><label for="check2">option 2</label>   <input type="checkbox" id="check3"><label for="check3">option 3</label>     <p id="text1">1</p> <p id="text2">2</p> <p id="text3">3</p> <p id="text4">4</p> <p id="text5">5</p> <p id="text6">6</p> <p id="text7">7</p> <p id="text8">8</p> <p id="text9">9</p> <p id="text10">10</p> <p id="text11">11</p>       <script> $(function() {       $( "#check" ).button();       $( "#format" ).buttonset();   });   $( "#check2" ).click(function() {       $( "#text2, #text3, #text6, #text7, #text8, #text9" ).toggle(display);    });$( "#check3" ).click(function() {       $( "#text2, #text3, #text5, #text6, #text7, #text8, #text9, #text10, #text11" ).toggle();   }); </script> </div> </body> </html> 

as can see of things want toggled appear 2 times.

i want able check , uncheck buttons @ using .hide instead did not work not reappear on second click.

if both selected want field appears twice hide.

anyone have asolution this?


Comments