Extract plain HTML from template?
oleander opened this issue · 1 comments
oleander commented
Is it somehow possible to extract the html content from a template?
I've i tried using ich.user({}).html()
, but that only returns the inner HTML of the template.
This one for example.
<script type="text/html" id="user">
<div id="a">
<div id="b">
<div id="c">
Content
</div>
</div>
</div>
</script>
When I use html()
i get this data.
<div id="b">
<div id="c">
Content
</div>
</div>
Any ideas?
HenrikJoreteg commented
Sorry it took me so long to see this, that's the bummer about using Github's organization accounts. No individual notifications, anyway.
Two options:
- By default you get a jQuery object (obviously). jQuery's 'html' is just a shortcut for innerHtml. What you're looking for is jQuery's
.get()
method, which just gives you the array of elements. - The other option, if you want plain text you can pass
true
as a second argument to the ich function. likeich.user({}, true)
Hope that helps, cheers!