Reputation: 29
Please help me to complete my code.
I want to hide all <li>
tags on body onload.
$(document).ready(function () {
$('li > ul').hide();
});
Please give me the right variant for the code!
Upvotes: 1
Views: 5917
Reputation: 29704
It's ul > li
, not li > ul
$(document).ready(function () { $('ul > li').hide(); });
Upvotes: 5
Reputation: 42808
$(function(){
$('li').hide()
})
This will search and hide every <li>
tag on the page. It is better to narrow down the search to improve performance Ex: $('#mydiv li')
where mydiv
is the id of the ul tag <ul id="mydiv">
.
Upvotes: 3