Reputation: 3183
It has a nested <ul><li>
made for jstree.
I need the the id of the li where '.jstree-checked' class in inserted.
In the jsfiddle I am just printing all the ids on the console and not searching for a specific class.
I am not able to get all the ids.
Upvotes: 0
Views: 136
Reputation: 108
$('li').filter('.jstree-checked').something();
would search all the li with .jstree-checked.
Upvotes: 1
Reputation: 2790
$('li.jstree-checked').each(function() {
console.log(this.id);
});
It will give you what you want.
I checked your mark up, by the way, it is highly unrecommended that using same ID for different objects.
Upvotes: 2
Reputation: 1127
Use Jquery wildcard operator '*' to accomplish this:
$('[class*=jstree-checked]').click(function(){
alert(this.id);
});
Upvotes: 0