Consider the following code from one of the view files:
<table>
<tr>
<th><%= f.label(:shop, "Shop:") %></th>
<td><%= select_with_new_option(f, :shop, :name, :id) %></td>
</tr>
...
</table>
select_with_new_option is my helper method that is defined in app/helpers/application_helper.rb. It generates a select box, containing all shops in this case, and in addition "Create new shop" option.
I would like to add a Javascript code that will display:
<div>
<label for="new_shop">New shop:</label>
<input id="new_shop" name="new_shop" type="text" />
</div>
once the "Create new shop" option is selected.
Is that possible to generate this Javascript code from select_with_new_option, or I should do this in other way ?