html(val),text(val),append(content)和其他(html(val), text(val), append(content) and the others)

这个问题听起来很主观,但我确实需要做出选择,为了让我这样做,我需要一些有经验的声音。

是否有资源,链接或意见,描述何时和考虑使用jquery的html(val),text(val)和append(content)将内容注入元素的问题?

这些是可比的吗? 或者他们都是为独立的任务而设计的?

问候,

KEM

This question might sound subjective but I really do need to make a choise and in order for me to do that, I need some experienced voices.

Is there a resource, link or opinion that describes when and considering what issues to use the jquery's html(val), text(val) and append(content) for injecting content into an element?

are these comperable? or they are all designed for separate tasks?

regards,

kem

最满意答案

那么, html(val)替换html内容, text(val )总是插入文本(不是标签), append(val)会将html内容附加到现有的html内容。 它们是不同的特性html(val)是最强大的功能。

Well, html(val) replaces the html content, text(val) inserts text (not tags) always while append(val) appends html content to the existing html content. They are different features html(val) being the most powerfull.

更多推荐