[thelist] style.display = 'none' and form elements

joe stowaway at uklinux.net
Tue Oct 7 13:10:27 CDT 2003


Ben Gustafson wrote:

><snip>
>The inText element is still found in the checkIfHidden() loop, and it still
>gets put in the query string when the form is submitted. I have tested this
>in IE6 and NS7.1 Am I misunderstanding how display is used or what it does?
>
>Thanks,
>
></snip>
>

Hi Ben

I think the display property is just that - it controls how the element 
is displayed on the browser.  Your element will be hidden but it will 
still be a structural part of the form.  What you could do is use the 
DOM to remove the element - something like:

function hide()
    {
        for (var i=0; i<elems.length; i++)
            if (elems[i].name == "inText")
                {
                nodeToRemove  = document.getElementById("inText");
                nodeToRemove.parentNode.removeChild(nodeToRemove);
                }
    }

hth

joe



More information about the thelist mailing list