{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/nunjucks/issues/1013","repository_url":"https://api.github.com/repos/mozilla/nunjucks","labels_url":"https://api.github.com/repos/mozilla/nunjucks/issues/1013/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/nunjucks/issues/1013/comments","events_url":"https://api.github.com/repos/mozilla/nunjucks/issues/1013/events","html_url":"https://github.com/mozilla/nunjucks/issues/1013","id":241958454,"number":1013,"title":"dynamically added nunjucks dont have access to javascript functions or variables","user":{"login":"sudhirbeldar","id":20295012,"avatar_url":"https://avatars3.githubusercontent.com/u/20295012?v=3","gravatar_id":"","url":"https://api.github.com/users/sudhirbeldar","html_url":"https://github.com/sudhirbeldar","followers_url":"https://api.github.com/users/sudhirbeldar/followers","following_url":"https://api.github.com/users/sudhirbeldar/following{/other_user}","gists_url":"https://api.github.com/users/sudhirbeldar/gists{/gist_id}","starred_url":"https://api.github.com/users/sudhirbeldar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sudhirbeldar/subscriptions","organizations_url":"https://api.github.com/users/sudhirbeldar/orgs","repos_url":"https://api.github.com/users/sudhirbeldar/repos","events_url":"https://api.github.com/users/sudhirbeldar/events{/privacy}","received_events_url":"https://api.github.com/users/sudhirbeldar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-07-11T07:53:26Z","updated_at":"2017-07-11T09:44:28Z","closed_at":null,"body":"Hello team, \r\n\r\nI am facing a issue where I have rendered a nunjucks file from browser js like show below\r\n\r\n$('.middle-content').html(nunjucks.render('account-verification.njk')\r\n\r\naccount-verification.njk is login form where I need have some validations for which I have validate.js in place. But my validations doesn't work.\r\nNow, the exact things works perfectly where in this njk is loaded from begining.\r\n\r\nAlso, If I add some logic on input fields to check input values from user, which is handled in javascript function in other .js file, its not working.\r\nBut if I write a <script> in same .njk file, its working.\r\n\r\nCan someone help me, how to dynamically render nunjucks file so that other jquery and javascript functions will be available without doing anything... or let me know if I am missing something in render method."},"comment":{"url":"https://api.github.com/repos/mozilla/nunjucks/issues/comments/314391939","html_url":"https://github.com/mozilla/nunjucks/issues/1013#issuecomment-314391939","issue_url":"https://api.github.com/repos/mozilla/nunjucks/issues/1013","id":314391939,"user":{"login":"ArmorDarks","id":4460311,"avatar_url":"https://avatars2.githubusercontent.com/u/4460311?v=3","gravatar_id":"","url":"https://api.github.com/users/ArmorDarks","html_url":"https://github.com/ArmorDarks","followers_url":"https://api.github.com/users/ArmorDarks/followers","following_url":"https://api.github.com/users/ArmorDarks/following{/other_user}","gists_url":"https://api.github.com/users/ArmorDarks/gists{/gist_id}","starred_url":"https://api.github.com/users/ArmorDarks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArmorDarks/subscriptions","organizations_url":"https://api.github.com/users/ArmorDarks/orgs","repos_url":"https://api.github.com/users/ArmorDarks/repos","events_url":"https://api.github.com/users/ArmorDarks/events{/privacy}","received_events_url":"https://api.github.com/users/ArmorDarks/received_events","type":"User","site_admin":false},"created_at":"2017-07-11T09:44:28Z","updated_at":"2017-07-11T09:44:28Z","body":"I didn't have much experience with client-side Nunjucks. We're mostly using it for statically rendered content, while React seems to be much more appropriate and easier to work with when it comes to client-side rendering.\r\n\r\nIf what I've described indeed a source of issue, you need to explore how to add event listeners to yet not existing elements. For instance, [here](https://stackoverflow.com/questions/10920355/attaching-click-event-to-a-jquery-object-not-yet-added-to-the-dom)."}}
{"actor":{"display_login":"ArmorDarks"}}