Re: [jQuery] Getting the optgroup for a select option (solution)

2007-01-16 Thread GreyCells
uot;label"); >/* ... do something with myOptGrpLabel... */ > > The parents("OPTGROUP") could be overkill, maybe just .parent() is enough > if you're sure the option elements are in an optgroup. > > George > > > > GreyCells wrote: >> >

Re: [jQuery] Getting the optgroup for a select option

2007-01-16 Thread GreyCells
.find("[EMAIL PROTECTED]").parents("OPTGROUP").attr("label"); >/* ... do something with myOptGrpLabel... */ > > The parents("OPTGROUP") could be overkill, maybe just .parent() is enough > if you're sure the option elements are in an optgroup. &g

[jQuery] Getting the optgroup for a select option

2007-01-16 Thread GreyCells
I'd like to be able to display the optgroup label attribute value after a select list is changed. This is what I have so far, but I think I'm heading down the wrong track, because a) I want the optgroup label value, not the selected option value and b) I don't want to keep appending if the user ch

Re: [jQuery] Hide div only if no child checkbox is selected

2006-12-19 Thread GreyCells
For anyone searching for similar answers, I've since learnt that this works too: $("#testDiv:not([input:checked])").hide(); The explanation (courtesy of Dave Methvin): #testDiv// select an element with id=testDiv :not( // as long as the following is not found

Re: [jQuery] How to not select something?

2006-12-19 Thread GreyCells
Excellent, Dave. Your explanation is much appreciated. I'd tried something similar in my 'period of frustration', but didn't know about the []'s denoting descendents. dave.methvin wrote: > >> What I'm trying to achieve is the element with id="save-search" only >> gets hidden if it does not co

Re: [jQuery] How to not select something?

2006-12-18 Thread GreyCells
Thanks Mike. Have to admit to a fatal flaw in my logic (that a nothing select would return nothing), but I'm still *extremely* impressed with JQuery (just not with myself) malsup wrote: > >> $(document).ready(function() { >> if (!$("#save-search div.error-message")) $("#save-search").hide();

Re: [jQuery] How to not select something?

2006-12-18 Thread GreyCells
is: > > $(document).ready(function() { > if ( $("#save-search div.error-message").length == 0 ) > $("#save-search").hide(); > }); > > Karl Rudd > > * A slightly obscure reference to Duck Typing - > http://en.wikipedia.org/wiki/Duck_typing > >

[jQuery] How to not select something?

2006-12-18 Thread GreyCells
should be, but it doesn't have the desired effect: $(document).ready(function() { if (!$("#save-search div.error-message")) $("#save-search").hide(); }); Would it be possible to let me know not just how to get this to work, but also where I'm going wrong? In search o

Re: [jQuery] Hide div only if no child checkbox is selected

2006-12-14 Thread GreyCells
Wow! Many thanks Chris, it worked a treat. There was me messing around with wildcards an' all :) Chris Domigan wrote: > > I think you can do: > > if (!$("#testDiv input:checkbox").is(":checked")) $("#testDiv").hide(); > > (Notice the "!"). Not tested though. > > Chris > > -- View this me

[jQuery] Hide div only if no child checkbox is selected

2006-12-13 Thread GreyCells
uot;' attribute. All I've managed to do so far is to hide/not hide the checkboxes that are checked - not quite the result I was hoping for :) Is this the sort of selection that JQuery can handle easily, or do I have to write a function? Many thanks ~GreyCells (now subscribed) --