I am trying to create a step form - which starts / shows some fields when something else is selected.
Here is an example - http://jsfiddle.net/XnPZF/ - it works (it also works in development).
I just canβt understand why this does not work when I click on Heroka.
Here is the version on Heroku .
Input: abc@test.com / test123
The fields that other fields should run right below it are Property_Type and Category.
Here is the code snippet:
/views/listings/new.html.erb
<%= simple_form_for @listing, :html => { :class => 'form-horizontal' } do |f| %> <%= f.error_notification %> <fieldset> <%= f.association :property_type %> <div style="display: none;" data-show-for-prop-type="Multi Family"> <h4>Multi-Family</h4> <%= f.input :taxes %> <%= f.input :house_families %> <%= f.input :house_extensions %> <%= f.input :house_stories %> <%= f.input :house_units %> </div> <div style="display: none;" data-show-for-prop-type="Condo"> <h4>Condo</h4> <%= f.input :taxes %> <%= f.input :common_charges %> </div>
listings.js file:
$('#listing_property_type_id').on('change', function(){ var option = $(this).find(':selected'); $('[data-show-for-prop-type]').hide();
source share