Click here to Skip to main content
13,354,885 members (72,745 online)
Rate this:
Please Sign up or sign in to vote.
Hello everyone,

I have an .ascx(controller) and a javascript files.

When i click the checkbox it must show and hide other checkbox, and not only the checkbox but the label too. The fact is now i succeed to make it hide just the checkbox. And i need to make hide the label too.

here is the raw code from ascx file:
 <li class="area">
   <input type="checkbox" class="category" value="<%# string.Concat(CurrentLocation.Area1,"| ", CurrentLocation.Area2)%>" />
   <asp:Repeater ID="Repeater2" runat="server" DataSource="<%# GetThirdAreas(CurrentLocation.Area2) %>">
              <input type="checkbox" class="category" value="<%#string.Concat(CurrentLocation.Area1,"| ", CurrentLocation.Area2,"| ", CurrentLocation.Area3)%>" />

And here is the javascript file:
function updateByArea(current) {
    //If current is unchecked => uncheck all child checkboxes
    if (current.attr("checked") == null || current.attr("checked") == "") 
        $j(".area ul li input [value^='" + current.val() + "']:checked").removeAttr("checked").hide(); //checkbox
    $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


how i add the label to javascript code so when the user clicks the checkbiox and hides the checkbox to hide the label too?

Thank you in advance
Posted 24-Sep-12 5:51am
Updated 25-Sep-12 22:46pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

When you view the source of the generated HTML ,you'll not see a ID for the label and it will be rendered as just label with the text inside it.You need to provide a ID to it so that you can find the lable using jQuery and hide it.

willockss 25-Sep-12 3:06am
I had give an ID to label.
i did like this:

<label id="last"></label>

and as jscript


And is still not hide the label
willockss 25-Sep-12 5:30am
It worked like this

willockss 26-Sep-12 3:28am
Thank you so much sir for your help.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

It worked like this:


Thank you once again for the help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180111.1 | Last Updated 26 Sep 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100