Topic: onchange with selectbox ????

can we use :onchange with select box like,

<%= select('contact', 'city', [ 'Mumbai', 'Paris', 'London'], { :onchange => "my_fun();" }) %>

here 'my_fun()' is my javascript function.


Any help ?


--
Thanks,
SN.

Re: onchange with selectbox ????

You need to have your onchange options after the regular options hash. In this case it would be empty

<%= select('contact', 'city', [ 'Mumbai', 'Paris', 'London'], {}, { :onchange => "my_fun();" }) %>