I have a select field that shows different elements of my form based on the selected value, I have three "classes" that each show the required portions of the filed. I currently have the selects bound to a .click() and it works fine except that if I want to load the page with the value preselected, it won't show the required parts of the form because the select field hasn't actually been clicked.
I've looked around and I don't see an event that would allow me to show information based on the selected value, but I'm not an expert so maybe I'm just misunderstanding some of the functions.
Here's the relevant portion of my HTML:
<select name="class">
<option value="vehicle" selected="selected">vehicle</option>
<option value="part">Part</option>
<option value="project">Project</option>
<option value="vehicle">Vehicle</option>
</select><br />
<etc...>
And my current jQuery switcher:
$("select option[value='project']").click(function() {
$('div.part-show').show().hide();
$('div.both-show').hide().show();
$('div.vehicle-show').hide().show();
});
Thanks so much!