is it possible to get selection from defined string? For example:
str = "<li>Some text...</li>";
Now I want to get that text between “li” tags, using str variable
as input. I tried something like that, but it didn’t work:
$(str + 'li').html();
Any ideas ?
To find the HTML of the inner
<li>have this:(Note that this will give you the inner HTML of the first list item only)
Live test case.
Edit: looks like that for more “complex” things you have to add the HTML to the actual DOM for jQuery to be able to parse it correctly.
To do that, add “dummy” container to the document:
Then have such code instead:
Updated jsFiddle.