Deepak Mallah
Deepak Mallah

Reputation: 4076

hide specific child element from an html using prototype

using prototype, I am trying to hide the specific children element of a particular element.

From the html below, I want to hide child ul and all of its element:

<ul>
   <li id="category_1" class="active">
   <strong id="img_1" class="cat_plus"></strong>
   <input type="checkbox" name="cat_id[]" value="1">
       <ul>
           <li id="category_3">
               <strong id="img_1" class="cat_plus"></strong>
                <input type="checkbox" name="cat_id[]" value="3">Root Catalog
           </li>
        </ul>
    <li>
</ul>

i tried:

$('category_1 ul').hide();

Upvotes: 2

Views: 213

Answers (1)

Damien
Damien

Reputation: 8987

I think this is what you are looking for.

$$('#category_1 ul').first().hide();

See fiddle

I hope it helps.

Upvotes: 2

Related Questions