How to get child element by class name?

I’m trying to get the child span that has a class = 4. Here is an example element: <div id=”test”> <span class=”one”></span> <span class=”two”></span> <span class=”three”></span> <span class=”four”></span> </div> The tools I have available are JS and YUI2. I can do something like this: doc = document.getElementById(‘test’); notes = doc.getElementsByClassName(‘four’); //or doc = YAHOO.util.Dom.get(‘#test’); notes … Read more

Set Value of Input Using Javascript Function

I’m currently using a YUI gadget. I also do have a Javascript function to validate the output that comes from the div that YUI draws for me: Event.on(“addGadgetUrl”, “click”, function(){ var url = Dom.get(“gadget_url”).value; /* line x ——>*/ if (url == “”) { error.innerHTML = “<p> error” /></p>”; } else { /* line y —> … Read more