i wanna to ask how to render and insert template to specific div. As we know from meteor wiki, this how to do that :
UI.insert(UI.render(Template.something), document.body);
and i place that to rendered or onAfterAction on IronRouter map, and it works. I have a div with id = "content", i wanna place the Template.something to that div, so i try with ordinary query code-like :
UI.insert(UI.render(Template.something), $('#content'));
and i place that to rendered or onAfterAction on IronRouter map, but it doesn't works. please help me how to render and insert to specific div? thanks
i wanna to ask how to render and insert template to specific div. As we know from meteor wiki, this how to do that :
UI.insert(UI.render(Template.something), document.body);
and i place that to rendered or onAfterAction on IronRouter map, and it works. I have a div with id = "content", i wanna place the Template.something to that div, so i try with ordinary query code-like :
UI.insert(UI.render(Template.something), $('#content'));
and i place that to rendered or onAfterAction on IronRouter map, but it doesn't works. please help me how to render and insert to specific div? thanks
Share Improve this question asked Apr 1, 2014 at 6:14 yozawiratamayozawiratama 4,32812 gold badges65 silver badges108 bronze badges 3- 1 How to get DOM node from a jQuery selector – user728291 Commented Apr 1, 2014 at 6:35
- Sorry, i had tried it before, but it didn't work – yozawiratama Commented Apr 1, 2014 at 6:40
-
Have you tried using
yield
? It seems it is designed for what you're trying to do. – Tomasz Lenarcik Commented Apr 1, 2014 at 8:17
1 Answer
Reset to default 8As the documentation says, UI.insert() expects a DOM node as its second argument.
UI.insert( UI.render( Template.something ), $( '#content' ).get(0) ));
If that is not working then try both Template.something
and $( '#content' ).get(0)
in then dev console to see what values they have.