In Ruby on Rails I am working with an inline RJS and trying to find out which select option was selected by accessing selectedIndex property. For some reason unable to get this to work.
So, for example assigning / altering the selectedIndex property works great:
page['model_author_id'].selectedIndex = 5
But reading it and doing a comparison within the RJS doesn't work:
if page['model_author_id'].selectedIndex == 0 then xxx end
I did a debug in Firebug and it seems that RJS generates the following (incorrect) code -
$("model_author_id").selectedIndex().= = 0;
So, the question is - how can I get the values of page elements using the RJS?