harsh harsh - 6 months ago 27
jQuery Question

How to re write innerHTML in jQuery

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.

Answer Source

Assume this in your code is a NodeList:

$(this).each(function() {

Or just: $(this).html(thehtmlval); because jQuery already did the loop for you inside.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download