-3

How do I write this in clean jquery

document.GetElementById('A').innerHTML+=str;
4

4 回答 4

4

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

于 2013-10-11T11:56:10.023 回答
3

Another way using .html() method:

$('#A').html(function(i, html) {
    return html + str;
});
于 2013-10-11T11:56:31.293 回答
1

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()
于 2013-10-11T12:00:43.557 回答
0

This is enough.

$("#A").append(str);
于 2013-10-11T11:56:42.157 回答