[jQuery] Re: How do I... select box onclick enable other form elements?

2008-06-10 Thread Hinch
I definitely need some more help, I cannot get this if lark to work out: $(document).ready(function() { $("#question").change(function() { if ($("option:selected") == "good answer") { $("#box2, "#autocomplete").attr("disabled", this.value == 'no'); } }); }

[jQuery] Re: How do I... select box onclick enable other form elements?

2008-06-09 Thread Josh Nathanson
That makes sense, though the code is needed a second time elsewhere and I think will require an 'if'. The fields are filled from the database so the other options can be selected. PHP checks whether they should be disabled or not at first but I need this disabled/enabled behaviour. Am I correct

[jQuery] Re: How do I... select box onclick enable other form elements?

2008-06-09 Thread Hinch
That makes sense, though the code is needed a second time elsewhere and I think will require an 'if'. The fields are filled from the database so the other options can be selected. PHP checks whether they should be disabled or not at first but I need this disabled/enabled behaviour. Am I correct i

[jQuery] Re: How do I... select box onclick enable other form elements?

2008-06-09 Thread Josh Nathanson
Oh... I need to add an 'if' statement to it (at least that's how my mind works after years with PHP!), something like this? I don't think you'll need that, if I'm understanding your use case correctly. When this.value is evaluated, it automatically uses the selected option to determine th

[jQuery] Re: How do I... select box onclick enable other form elements?

2008-06-09 Thread Hinch
Thanks, that will do nicely. I have never used 'change' before - it looks very useful. On Jun 9, 8:55 pm, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: > You want the "change" event...give this a go. > > $("#question").change(function() { > $("#box2, #autocomplete").attr("disabled", this.value

[jQuery] Re: How do I... select box onclick enable other form elements?

2008-06-09 Thread Hinch
Oh... I need to add an 'if' statement to it (at least that's how my mind works after years with PHP!), something like this? $("#question").change(function() { if !($("option:selected") == "This") { $("#box2, #autocomplete").attr("disabled", this.value == 'no'); } }); Simply I want to ask

[jQuery] Re: How do I... select box onclick enable other form elements?

2008-06-09 Thread Josh Nathanson
You want the "change" event...give this a go. $("#question").change(function() { $("#box2, #autocomplete").attr("disabled", this.value == 'no'); }); -- Josh - Original Message - From: "Hinch" <[EMAIL PROTECTED]> To: "jQuery (English)" Sent: Monday, June 09, 2008 12:10 PM Subject