Hide checkbox and label

booz2828

New Member
THE SCENARIO:I have an ul an li and a checkbox and label inside a repeater, these form all together a list of checkboxes. And i have an javascript file that controls the checkboxes behavior. I succeed to hide the checkboxes with javascript code, but when i tried to hide the label it didn't work.I will post the code ASP.NET for a better understanding:\[code\]<asp:Repeater ID="Repeater1" runat="server" DataSource="<%# GetSecondAreas(CurrentLocationName) %>"><HeaderTemplate><ul></HeaderTemplate><ItemTemplate><li class="area"><input type="checkbox" class="category" value="http://stackoverflow.com/questions/12578196/<%# string.Concat(CurrentLocation.Area1,"| ", CurrentLocation.Area2)%>" /><label><%#CurrentLocation.Area2%></label><asp:Repeater ID="Repeater2" runat="server" DataSource="<%# GetThirdAreas(CurrentLocation.Area2) %>"><HeaderTemplate><ul></HeaderTemplate><ItemTemplate><li><input type="checkbox" class="category" value="http://stackoverflow.com/questions/12578196/<%#string.Concat(CurrentLocation.Area1,"| ", CurrentLocation.Area2,"| ", CurrentLocation.Area3)%>" /><label id="last"><%#CurrentLocation.Area3%></label></li></ItemTemplate><FooterTemplate></ul></FooterTemplate></asp:Repeater></li></ItemTemplate><FooterTemplate></ul></FooterTemplate></asp:Repeater>\[/code\]And here is the javascript code:\[code\]function updateByArea(current) {//If current is unchecked => uncheck all child checkboxesif (current.attr("checked") == null || current.attr("checked") == "") $j(".area ul li input[value^='" + current.val() + "']:checked").removeAttr("checked").hide(); //checkbox $j('label[id="id_val"]').hide();$j("#searchFilter .area>input:checkbox:checked").each(function (i, item) { $j(".area ul li input[value^='" + $j(item).val() + "']:not(:checked)").attr("checked", "checked").show(); //checkbox $j('label[id="id_val"]').show();});\[/code\]}What i've posted here is what i tried just for the label with the id="last"THE QUESTION:Did i made correct the javascript code for the label, so when I tick the checkbox to hide and show the checkbox and the label together?P.S: On the code that i have right now it hides just the checkbox.Thank you in advance
 
Back
Top