When using jQuery to dynamically build markup, it sometimes becomes useful to return the actual HTML that it generates as a string, rather than as a bunch of jQuery objects. Is there any way to do this? For example, here:
$("<strong></strong>").text("Hi there!");
I want to extract a plain text string
"<strong>Hi there!</strong>"
so that I can cache it remotely. Is there any way to do this?
source
share