I have a bunch of data in a single model that I want to display based on collection select (drop down) box. The section data looks like this...
class CreateSections < ActiveRecord::Migration
def change
create_table :sections do |t|
t.string :supervisor
t.string :catagory
t.string :title
t.string :description
t.string :days
t.string :start_date
t.string :end_date
t.string :start_time
t.string :end_time
t.string :course_id
t.string :room
t.string :building
t.string :location
t.string :tuition
t.string :lab_fee
t.string :insurance_fee
t.string :technology_fee
t.timestamps
end
end
end
My collection select looks like this...
collection_select(:section, :section_id, @sections, :id, :title)
So the user will select the title from the drop down, and I would like to display the description. Ideally I would like to do this with jquery.
EDIT
Here is more info on what the html looks like...
<select id="section_section_id" name="section[section_id]"><option value="1">Long Title</option>
<option value="2"> Alternative Investments for Small Business NEW</option>
<option value="3">Bookkeeping Basics for the Natural Products Industry NEW </option>
...
In app/assets/javascripts/sections.js I now have...
$(function(){
$("#section_section_id").change(function(){
alert('wintas');
})
})
So now based on the option that is selected, I would like to display the value associated with that option.