To make it check on change: $('#mySelectId').change(function(){ if($(this).val().indexOf('someValue') != -1) $('#someElement').hide(); });
On Jan 16, 12:30 pm, Wizzud <[EMAIL PROTECTED]> wrote: > var txt = $('theSelect :selected').text(); > if(txt == 'cat' || txt.indexOf('c')==0 || ...test after test after > test...){ > $('selector_fieldToHide').hide(); > > } > > On Jan 15, 1:16 pm, Bhaarat Sharma <[EMAIL PROTECTED]> wrote: > > > > > Thanks! > > > but the values of this drop down box are dynamic and are coming from a > > DB. So I was wondering if jquery offers a method so that rather than > > doing '.val()' i could do something else so that I would get search on > > content of the option box rather than value. so for example > > > <option value="my_val">cat</option> > > > So here i would like to see if the option contains 'cat' or starts > > with 'c' or something like that... > > > Also, i know that jquery supports chained method but how does it work > > with logical operators like && or || > > > so in the example you have mentioned..what if i wanted to do a check > > for 'my value2' as well... > > > I appreciate your help! > > > On Jan 14, 8:39 pm, "Benjamin Sterling" > > > <[EMAIL PROTECTED]> wrote: > > > Something like below should work: > > > > if($('select[name=myDropdown] :selected').val() == 'my value'){ > > > $('input[name=inputToBeHidden]').hide(); > > > > } > > > > On 1/14/08, Bhaarat Sharma <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > > > I'm a little new to jQuery. > > > > > Is it possible to hide/disable a text field based on a certain value > > > > in a drop down box on the same page?? > > > > > I'd appreciate if someone could either show me a similar example or > > > > guide a little. > > > > > Thanks > > > > -- > > > Benjamin > > > Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.comhttp://www.benjam...- > > > Hide quoted text - > > - Show quoted text -