I have a problem with executing jQuery code at EJS template. My code:
$.json('/data.json', function (data) {
new EJS({url: 'template.ejs'}).update('mycontainer', {data: data});
})
It works. But when I've tried to use some jQuery plugin at this template - nothing. Example of my EJS-template:
<script>
alert(0);
$(document).ready(function () {
$('#someId').someJQplaugin();
})
</script>
<div id="someId"><%= data.someValue%></div>
Plugin and alert(!!) is not working. Then i replace my code between <% %>
tags. Alert and document.ready is working, but jQuery can't find the object at appended EJS template.
I've tried to use jQuery out of template, but result is the same:
$('#someId')
is null.
How do I use EJS and jQuery together?