What is the difference between jQuery: text() and html() ?

后端 未结 16 1479
傲寒
傲寒 2020-11-22 03:45

What the difference between text() and html() functions in jQuery ?

$(\"#div\").html(\'Linkhello\         


        
16条回答
  •  误落风尘
    2020-11-22 04:41

    text function set or retrieve the value as plain text, otherwise, HTML function set or retrieve the value as HTML tags to change or modify that. If you want to just change the content then use text(). But if you need to change the markup then you have to use hmtl().

    It's a dummy answer for me after six years, Don't mind.

提交回复
热议问题