I have a code as you can see below. I am trying to find the html() of each span item under a certain div
for example: the div #hello should return :”this is” and “a nice” and “block of spans”
html as follow:
<div id="hello">
<span id="info1"> this is</span>
<span id="info2">a nice</span>
<span id="info3"> block of spans</span>
</div>
<div id="bye">
<span id="info4"> more</span>
<span id="info5"> spans</span>
</div>
and this is the jquery I tried:
<script>
function values() {
var poo=$('div#hello').find('span').html();
alert(poo);
}
</script>
the issue with the code I have is that it only does an alert for the first value “this is”
I need it to do an alert for all of the values. any suggestions ? thank you
You can use
eachlike this to get html of each span element: