Because the code in the project is too much in the way, it simplifies the code, only the description, not the code, but the method works.
Omit HTML code ... <div id= "Leftmenu" ></div> <!--for storing append HTML container--><input type= "button" onclick= "C Learhtmlfun () "/> <!--Remove the contents of the Append HTML--><script type=" Text/javascript ">var $html =" ";//global variable for storing HTML text objects $ (function () {var strhtml = "<ul>"; strHTML + = "<li>aaa</li>"; ..... strhtml + = "</ul>"; $html = $ ("" + strHTML + "); This step is critical, as shown in Figure 1:firebug using the Console.info ($html) object | I test without "" will have a problem, not clear why $ ("#leftMenu"). Append ($html); Append data using append});//Delete the contents of the appended HTML Clearhtmlfun = function () {$html. Remove (); Because the object is stored previously, you can use. Remove (), otherwise firebug will report. Remove () is not a function= return to see the one in Figure 1.}</script>
Figure 1:
JQ use append to add HTML text and then delete the HTML text