我想知道是否可以使用 jquery 或 javascript 在 HTML 元素中插入附加文本?
如果段落元素中已经有文本“Down”,那么我只想附加文本“full”,这样它将是“Down full”。这可能吗?我应该使用哪种方法?
最佳答案
使用 jQuery,看看 .append()
:
Insert content, specified by the parameter, to the end of each element in the set of matched elements.
例如:
$('p').append(' full');
关于javascript - 如何使用 jquery 或 javascript 插入附加文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3028272/