Belinda, you can also use the .change() method on the <select> element if you want (the part you commented out was just fine). Then you can either get the selected option's value like this ...

q(this).text()

or its text like this ...

q(':selected',this).text()

As Olaf mentioned, the real problem was that you were trying to find q ('input[name=sweets]') when you should have been using q('select [name=sweets]')


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Oct 17, 2007, at 8:54 PM, Olaf Bosch wrote:


Belinda M. Giardine schrieb:
I have found this question in the archives and set up a test page based on the responses I have found. But for me it is not working, the section is hidden and doesn't reappear no matter what is selected. I have tried several different browsers. The real task is on a more complex page, I am just trying to get the simple test to work first.

and here the full function:

q(document).ready(function(){
  q("div.subSection").hide();
  q("option").click (function() {
    var opt = q(this).text();
    alert (opt);                   // delete this row
    if (opt == "Cookie") {
      q("div.subSection").show();
    } else {
      q("div.subSection").hide();
    }
  });
});


--
Viele Grüße, Olaf

-------------------------------
[EMAIL PROTECTED]
http://olaf-bosch.de
www.akitafreund.de
-------------------------------

Reply via email to