[thelist] appendChild() exception

joe stowaway at uklinux.net
Sat Oct 25 06:35:00 CDT 2003


Hassan Schroeder wrote:

>>
>> if I understand you correctly, the text "Tick the box to ignore these 
>> search criteria" is not a child of 'qsfcontrol' which would explain 
>> why when I originally tried replaceChild(), nothing at all happened, 
>> no errors, nothing.  Is it then a sibling?
>
>
> Yes.
>
>> checking the box disables part of the form (nice idea I got from 
>> Nelson in an earlier thread) and I want to toggle the text next to 
>> the box. the form isn't in a table, so the box and the text aren't 
>> separable by <td>, so I'm wondering what is the semantically correct 
>> way to structure the message next to the text box.
>
>
> Well, properly, that text should be in a LABEL tag. That slightly
> complicates the JavaScript, since either the checkbox or the label
> can be clicked to activate your function,
>
> Note: if for whatever reason you can't be sure that <input/><label>
> will be immediately adjacent, without *any* space, you need to add
> a test that nextSibling is not a text node; probably good practice
> in any case...
>
> Holler if any of the above doesn't make sense :-)

hi Hassan

thanks for that - the label tag makes perfect sense, don't know why I 
hadn't run into it before... %)

I had run into the problem with spaces - I was using tabs in my text 
editor to make my code readable, and was surprised to discover that 
although the browser has always ingnored it for formatting to screen, it 
was all over the place in the DOM and turning my world to crap! when you 
know it, it makes sense, but it's a little counter-intuitive when you 
don't...

thanks again

joe



More information about the thelist mailing list