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

Asked

Viewed 160 times

8

What’s the difference between text() and html()?

$("#div").html('<a href="example.html">Link</a><b>hello</b>');

vs

$("#div").text('<a href="example.html">Link</a><b>hello</b>');

Which is the best to use and under which conditions?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.