Thursday, December 3, 2009

[jQuery] Selector issue

Well i'm in trouble.

Following code does not trigger :

Code: Select all
$("#cat_list > div").click(function()
{ alert("Bye bye!");;
});

neither

Code: Select all
$("#cat_list ~ div").click(function()
{ alert("Bye bye!");;
});

or

Code: Select all
$("#cat_list > *").click(function()
{ alert("Bye bye!");;
});

Altough this works :

Code: Select all
$("#cat_list").click(function()
{ alert("Bye bye!");;
});

HTML code looks like :

<div id="cat_list">
<div id="39">a</div>
<div id="40">b</div>
...
</div>

Any idea ?

thanks

No comments: