javascript - In Meteor How to find a DOM element (after render)? -


i'm new meteor.

i want use javascript copy text h1-element div-element.

i started this:

cd /tmp meteor create dad cd dad meteor deploy dad.meteor.com 

i created template:

<template name='dad1'>   <h1 id='id1'>hello</h1>   <h2 id='id2'>world</h2> </template> 

i wroted js:

// dad1.js if (meteor.isclient) {   template.dad1.onrendered(function(){     var myh1 = this.find('id1');     var myh2 = this.find('id2');})} 

when step through above js in browser both myh1 , myh2 stay null.

question: how find dom element (after render) can operate on it?

the template's find method takes css selector argument, you'd need pass #id1 instead of id1.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -