How do I write this in clean jquery
document.GetElementById('A').innerHTML+=str;
How do I write this in clean jquery
document.GetElementById('A').innerHTML+=str;
Use append() if you just want to add more contents to the container element without changing the existing elements.
$('#A').append(str)
Note: See my comment to VisioN's answer below
Another way using .html()
method:
$('#A').html(function(i, html) {
return html + str;
});
if you want to add some text in innerHTML then Arun's answer is right if you wish to get innerHTML then you can use
$('#A').html()
This is enough.
$("#A").append(str);