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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
36b74fe7800da1558db814a9195cddfa?d=identicon&s=25 Jeff Matthews (jtodd)
on 2006-03-09 19: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
avail.

How do I call javascript without an event in rails?

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