Reputation: 8408
All
I want to get only "All" without <ins>
When I use $j(this).parent().html()
I get
<ins class="jstree-checkbox"> </ins>
<ins class="jstree-icon"> </ins>
All
but I need only "All" How can I get it ?
Upvotes: 2
Views: 360
Reputation: 5335
Try the following to get 'All'
obj = $(this).parent().get(0);
var allText = obj.lastChild.nodeValue;
Upvotes: 2
Reputation: 8408
($j(this).parent().html().substring(78, $j(this).parent().html().length)
Any better solutions ?
Upvotes: 1
Reputation: 322452
Assuming the .parent()
part is correct, try this:
var result = $j(this).parent().contents().last().text();
You may want to trim the result, because there will likely be white space.
var result = $j(this).parent().contents().last().text();
result = $j.trim(result);
Or if there isn't any other text, you can just do this:
var result = $j(this).parent().text();
Upvotes: 4