68
rated 0 times
[
74]
[
6]
/ answers: 1 / hits: 21604
/ 10 Years ago, fri, december 5, 2014, 12:00:00
I have two similar selections. The first uses a <div>
tag, which works fine, the second uses a newly <template>
tag, which doesn't work anymore.
Can anyone tell me how to get this to work with jQuery using the <template>
tag?
HTML
<div id=div>
<div>content</div>
</div>
<template id=template>
<div>content</div>
</template>
JavaScript
var $div = $('#div');
var $content = $div.find('div');
console.log($content); //works ($content.length == 1)
var $template = $('#template');
var $content = $template.find('div');
console.log($content); //doesn't work ($content.length == 0)
http://jsfiddle.net/s8b5w0Le/1/
More From » jquery