I have HTML code like this:
<div class="a">html value 1</div> <div class="a">html value 2</div>
How can I access html value 1 and html value 2 using jquery?
html value 1
html value 2
Try this:
var a = document.getElementsByClassName('a'); for (var i = 0; i < a.length; i++) { alert(a[i].innerHTML) }
demo