THE ZEPINT NETWORK

programmer assist

Ruby Ruby XML Feeds

Ruby Questions Ruby Solutions Ruby Articles

Ruby is a reflective, dynamic, object-oriented programming language. It combines syntax inspired by Perl with Smalltalk-like object-oriented features, and also shares some features with Python, Lisp, Dylan, and CLU. Ruby is a single-pass interpreted language. Its official implementation is free software written in C.

Accessing an HTML element in a RJS template?

DiggBlinkRedditDeliciousTechnorati

question by Bejaan | Moderate

In a RJS template I need to access the innerHTML property of a element and pass it to a render call. Ideally, I want to be able to do something like this.

displayvalue = ['building1_display'].id
page.replace landlord_row_id, :partial => 'display_landlord', :locals
=> {:display => displayvalue}


I think the first line is the problem, I don't think there is anyway to referance the properties of a element in a RJS template. Am I right or is there a way?

Post reply Subscriptions

Re: Accessing an HTML element in a RJS template?

reply by Srirangan

I'm not sure of a way to do this, although it is pretty straightforward to make javascript calls in RJS, so I wonder if you could restructure your code such that the logic uses a javascript function on the page, and uses RJS to call that function/pass parameters?

Post reply Subscriptions

Got a Ruby Question?

Just Sign Up and ask the top Ruby experts!

Search via Google

User Login

Email Address

Password

Ruby Experts

Rank Expert Points
#1 Srirangan 1500
This a list of the Top Ruby experts, how many points do you have?

Leading Experts

Rank Expert Points
#1 frankzzsword 4650
#2 Bejaan 2950
#3 csfreak 1100
#4 Anurag 700
#5 keyvez 700
#6 nnarasimha 600
#7 Nakata 600
#8 martinig 600
#9 mastercomputers 550
#10 Abhishek Chatterjee 250
#11 Abels 250
#12 Huntress 150
#13 Adkron 150
#14 Yogesh 100
#15 lexxwern 100
This is a list of overall best performing experts, how many points do you have?