Getting the element properties of a rendered template

I’ve fallen in love with Meteor, but since I’ve had too few time to master it, I’ll ask (probably) trivial questions. Here is one:

Let’s say I have a template with:

		<div id="email">{{email.text}}</div>...

which gets populated by:

email: function () {
return Info.findOne({name:‘email’});

And now in:

Template.header.onRendered(function () {

I want to get width of the div, I mean width as it is rendered, with text and all, but this:


returns me 0

I sure have some mindflaw and it’s late night now, cant think further and reckoned I might as well ask for some elegant solution from you guys. I tried lots of things but I’m sure the solution lies somewhere in Meteor logic so let’s hear it!

Oh, and hi there btw, it is my first post here. Nice to meet and all.

Yours Truly

Realized that the problem is wider than I thought - Can't access jQuery objects within onRendered

Correct me if i’m wrong, but there is no way to access rendered DOM objects in Like when I need to recalculate element’s position according to changed viewport or just get data from SVG object? Because I can’t do that in helper nor event as far as I can think right now. As I just said, correct me please?

This really is an active and helpful society, this meteor forum.

Did you read the post you quoted? There are answers in there. In brief, you can access DOM elements using jQuery within onRendered, but you have to be aware that with reactive templating the meaning of onRendered is not necessarily what you might think it is.

Yes, I think I realized the problem’s scope, Blaze’s limits and all the DOM manipulating ideas displayed in this and some other corresponding threads. In fact I use one of them right now. I simply tried to reiterate the question in more specific frame and probably failed. You see, I have not that long history of JS behind me and that causes the continous doubt, that somewhere there is a completely different solution that I failed to notice at all.
My problem with reactive template here in meteor was actually this - I needed to send callback to template to get populated element’s data to guide responsive page’s animations according to viewport and I had no idea how to achive this cause template rendering and populating are not the same here and I had no idea which event to bind it with, thought you guys have. Literally I was trying to attach my code at the very and of asynchronous loading and I did not get the whole picture. I still don’t 100%, but I have solved my problem and have none new.
What you mean ‘in brief’?


Thought so.

Well, I am good. My long post was not for you but for oncoming people facing same problem.