views:

13

answers:

0

hi,

I am using select_tag, and onchange i want to check if selected option value = "Add New Item"

then call function

I have used code below

<%= select_tag "name", options_for_select(searchresults.collect{ |w| [w.first_name, w.id]} + ["Add New Name"]),{ :onchange => "if $('+this.value') == "Add New Name" { addNew(); }" ,:class =>"frmSelect", :id=>"search_hits"}%>

please tell me how to check the selected value onchange and call the function addNew()