Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Javascript DOM help

I want this label to be invisible
<label class="Radio" for="Radio_FCKeditor">Toolbar</label>
this should work. but it isn't
var elems = document.getElementsByTagName("label") ; for (var i = 0; i < elems.length; i++) { if (elems[i].attributes["for"].value == "Radio_FCKeditor") { elems[i].style.display = "none"; } }

How do I add the !important string next to none, because its being owerwritten

Comments

  • It"d be MUCH more efficient to give your targeted label an ID and then just reference that ID.
    document.getElementById('your_id').style.display = 'none';
  • yeah but the label tag is generated by Vanilla. not by me.
    I used visibility:hidden instead
  • edited May 2007
    It should be:if (elems[i].attributes["htmlFor"].value == "Radio_FCKeditor") {'for', 'style' and 'class' attributes have a special name in the html DOM: 'htmlFor', 'cssText' and 'className'.
  • thanks dino
    do u know of a way to make the style.display = none take precedence. Now now its being overwritten by vanilla css. So i used visibility :hidden instead.
  • Using style.display should be equivalent of using inline style so, it shouldn't be overwritten - I think.

    Here is what I use to hide elements:/** * Hide on element. * @param {DOMelement} elem Element to hide */ hide = function(elem){ if(elem.style && typeof(elem.style.display) !== 'undefined'){ elem.$oldDisplay = elem.style.display; // Saved the display for later use. John Resig, 2006. elem.style.display = 'none'; } }; /** * Show a hidden element. * @param {DOMelement} elem Element to show */ show = function(elem){ if(elem.style && typeof(elem.style.display) !== 'undefined'){ elem.style.display = elem.$oldDisplay || ''; } };
This discussion has been closed.