Forum: Ruby on Rails Get width of an element using javascript

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jeff M. (Guest)
on 2006-03-09 20:19
I need to get the width of an element into a ruby variable.

I have tried using various methods to call a javascript function that's
in the prototype library called getDemensions. I'm just not sure how to
perform the call.

document.GetElementById(id).offsetWidth works fine with and onClick
event, but I need to get the width value at various time during the page
load. I also tried the remote_function and javascript_tag methods, to no

How do I call javascript without an event in rails?

Any suggessions?
This topic is locked and can not be replied to.