[jQuery] Re: how can a text field be hidden based on condition

2008-01-16 Thread Hamish Campbell
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

[jQuery] Re: how can a text field be hidden based on condition

2008-01-15 Thread Bhaarat Sharma
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

[jQuery] Re: how can a text field be hidden based on condition

2008-01-15 Thread Wizzud
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

[jQuery] Re: how can a text field be hidden based on condition

2008-01-14 Thread Benjamin Sterling
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