Hi everyone! I started using jQuery yesterday so im a noob.
I have a navigation bar, and i want it to display a background image on the active menu item. (Like the top most menu on this website, it has a little blue underline) So i got this function: Copy code 1. function displayBgImg() { 2. for (var i=0; i<$("ul#nav_prim a").length; i++) { 3. if ($("ul#nav_prim a")[i].href == document.URL) { 4. $("ul#nav_prim a")[i].css("background-image", "url(images/nav_bg.gif)"); 5. } 6. } 7. } Line 2: It loops though all the tags in an <UL> with id nav_prim. (The tags are inside of <li>'s in the <ul>. Line 3: I check to see if the tag's href atribute is the same as the URL of the page, if it is Line 4: i want that specific tag's background-image to be images/nav_bg.gif. I can't get it to work. In firefox i get the error " $("ul#nav_prim a")[i].css" is not a function. Why is that? Can anyone please help me? As i've said im new to jQuery and Javascript in general aswell. Thanks for any advice :) -- View this message in context: http://old.nabble.com/tooone7-Can%27t-understand-this...-Want-to-make-a-image-appear-on-active-link-tp27686495s27240p27686495.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.