I have the following in my js.
for (var i = 0; i < this.length; i++) {
this[i].innerHTML = thehtmlval;
}
I want to write the same in jQuery.
I did some search and saw this but dont know how to apply it in this case. Can someone please help.
Assume this
in your code is a NodeList
:
$(this).each(function() {
$(this).html(thehtmlval);
});
Or just: $(this).html(thehtmlval);
because jQuery already did the loop for you inside.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With