Hi,
I have span elements inside <li>, how can i access and change the text dynamically?
<ul id="listA">
<li><span></span></li>
<li><span></span></li>
<li><span></span></li>
<li><span></span></li>
</ul>
$("ul#listA li:nth-child(1) span").innerText() gives you text inside the first li and span
Not sure if this is what you are looking for
list elements can be looped as
var listItems = $("#listA li");
listItems.each(function(li)
{
// do your stuff
$(this).children('span').text("my content");
});
How can i do this in a loop inside another function?
I want the list to be accessed inside a function and then alter the contents dynamically.