jquerytemplateshtml5-template

jQuery and html 5 <template> tag


I have some problem with jQuery. When am trying use:

document.querySelector('#container').appendChild(content.cloneNode(true));

it's ok, but jquery have wrapper around the object, so i can't just type:

$('#container').content

Does anyone have any ideas?


Solution

  • If you want to access the actual DOM element for a single-element selection, use $('#container')[0] or $('#container').get(0).

    If you had multiple elements in your selection, you could get them by index: .get(1), .get(2) and so on.