Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET Javascript HTML C#4.0 , +
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
Edited 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 at 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 at 25-Sep-12 5:30am
It worked like this
willockss at 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
0 Zoltán Zörgő 180
1 Sergey Alexandrovich Kryukov 155
2 Peter Leow 100
3 CPallini 70
4 Ramza360 51
0 Zoltán Zörgő 80
1 the other paul 23
2 Shmuel Zang 10
3 Aarti Meswania 5
4 Member 11389991 -2

Advertise | Privacy | Mobile
Web02 | 2.8.150129.1 | Last Updated 26 Sep 2012
Copyright © CodeProject, 1999-2015
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