jquery - checkbox oncheck javascript -


I have a checkbox, when I'm clicked, I need to show a division. I have 3 different javascript with whom I have tried to work with it.

  // function showhide () {// var checkbox = document.getElementById ("help"); // var Extended 1 = Document. getElementById ("Extended"); // var Extended 2 = Document. getElementById ("expanded2"); // expanded1.style.visibility = (expanded1.style.visibility == 'false')? "right wrong"; // warning ('test'); //} function () {var checkbox = document.getElementById ("helper"); Var extended 1 = document. GetElementById ("extended"); var extended 2 = document. getElementById ("expanded2"); checkbox.onchange = function () {expanded1.style.visibility = this.checked? 'right wrong'; Warning ('test'); } // function check () {// $ ('chk') click (function () {// if (this.checked) {// $ ("# expanded") show (); // $ ( "# Expanded2"). Show (); //} // else {// $ ("# extended"). Hide (); // $ ("# expanded2"). Hide (); //} // }); //}   

This is the checkbox below.

  & lt; Input type = "checkbox" runat = "server" id = "help" onclick = "look hidden ();" / & Gt; & Lt; / Div & gt; 

wrong

Use window.onload to specify the replace handler and Remove the inline onclic from HTML with the visibility css visible or hidden .

  window.onload = function () {var checkbox = document.getElementById ("helper"); Var extended 1 = document. GetElementById ("extended"); Checkbox.onchange = function () {expanded1.style.visibility = this.checked? 'Visible': 'hidden'; }; };    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -