Figured it out ... $(document).ready(function(){ var hearOther = $("#hear_other"); hearOther.hide(); $("#hear").change(function(){ var hearValue = $("#hear option:selected").val(); if( hearValue == "O"){ hearOther.show('fast'); }else{ hearOther.hide('fast'); } }); });
On Mar 24, 12:01 am, EasyThereTiger <[EMAIL PROTECTED]> wrote: > I'm a complete newbie to jQuery trying to perform a relatively simple > task, but can't figure it out. > > Based of the value of a select option, I want to hide/show a div. How > do I get the value of the select option? Here's what I have below. > > Thanks for your help! > > $(document).ready(function(){ > var hearOther = $("#hear_other"); > hearOther.hide(); > $("#hear").change(function(){ > if( $("#hear_other option[value='O']")){ > alert('show hearOther'); > }else{ > alert('hide hearOther'); > } > }); > > }); > > <select id="hear"> > <option value="T">Television</option> > <option value="R">Radio</option> > <option value="O">Other</option> > </select> > <div id="hear_other">Please describe “Other”</div>