jQuery .each problem -
Need to squeeze the brain and help,
I have 6 rows that can be hidden or Visible on the basis of a check box check, it works better than a small problem - when the last check box (val = "5") is checked and you press the refresh button then line 6 (class = " Hidden 5 ") is hidden. It is only on the last check box - any checked checkbox is displayed.
$ (document) .ready (function ($) {$ ('input: checkbox'). ($ ('$ View' + rowIndex) .is (': checked') == true) {$ ('. Hide' + line index). Show ();} and if ($ ('$ View' + rowIndex) .is (': checked') == incorrect) {$ ('. Hide '+ line index) .hide ();}}); $ ('Input: Checkbox'). Click (function () {Var line = this.value; $ ('. Hide' + line) Toggle ();});});
6 HTML source for th line is:
& lt; Tr class = "hide5" & gt; & Lt; Td width = "175" align = "center" style = "padding: 1px 0px 11px 0px" & gt; & Lt; Br / & gt; & Lt; Span & gt; Total & lt; / Span & gt; & Lt; Br / & gt; & Lt; Span & gt; & Amp; Nbsp; & Lt; / Span & gt; & Lt; Br / & gt; & Lt; / TD & gt; & Lt; Td width = "175" align = "center" & gt; & Lt; Input class = "auto" type = "text" id = "bw pound" size = "18" alt = "p8c3pvS" /> & Lt; / TD & gt; & Lt; Td width = "175" align = "center" & gt; & Lt; Input class = "auto" type = "text" id = "bw pound" size = "18" alt = "p8c3pvS" /> & Lt; / TD & gt; & Lt; / TR & gt;
">
Try this:
$ (document) .ready (Function ($) {$ ('input: checkbox'). Each (function (line index) {var $ row = $ (this); if ($ row.is (': check')) {$ ('. Hide '+ line index.) Show ();} and {$ ('. ',' + 'The line index) .hide ();}}}) $ (' input: checkbox '). (Function () { Var row = this.value; $ ('. Hide' + line). Toggle ();});});
Comments
Post a Comment