This may have been asked, but scrolling through about 40+ search results reveals only the jQuery solution. Let's say I want to get the first item in an unordered list and apply a new text color to it, and it alone. This is simple with jQuery.
Markup ->
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
With jQuery ->
$("ul > li:first").css("color", "blue");
Question is, how do I achieve this without jQuery?
SOLUTION: I found this method to work across all browsers (inc IE7+) ->
document
.getElementsByTagName("ul")[0]
.getElementsByTagName("li")[0]
.style.color = "blue";
See Question&Answers more detail:os