tags:

views:

66

answers:

2

Hi again, I can't find the way to do a very simple thing: I have some <li> with a class like the following:

<li class="picture 62033">lala</li>
<li class="video 41463">lala</li>
<li class="video 53553">lala</li>
<li class="video 53554">lala</li>
<li class="video 51483">lala</li>
<li class="video 36715">lala</li>

displayed on a page where I also have this div (the number changes from page to page)

<div id="nodenid">51483</div>

I just want to .hide() the <li> with that ID. Something like this

$(".mypage").find('li').hide();

but that, of course, hides all of them :)

How can I get the value from the #nodenid and use it to hide the matching <li>? Thanks

+3  A: 
$("LI." + $("#nodenid").html() ).hide();

The argument of $() is CSS selector. So, to select LI with class 1321132 you need to use $("LI.1321132") or just $(".1321132")

valya
Thanks!! I couldn't find the + operation inside the $(), now I know how to do it (and it works)
Ferran Gil
+ is just string operation, it has nothing to do with jquery :)
valya
A: 

Something like

var classname = $('#nodenid').val();
$("." + classname).hide();
Sheff
That seems to work too. I did the the first line myself, with the .val() or .html() but I didn't know about the plus... thanks
Ferran Gil