Home > Article > Web Front-end > Regarding the $("body").append() piece of html code, writing it on the page can trigger an event, but writing it in a js file will not_html/css_WEB-ITnose
$('body').prepend('<div id='nav' class='navbar'><div class='navbar-content'><a href='/' class='element'><span class='icon-grid-view'></span> 后台管理 <sup>1.0 Beta</sup></a> <span class='element-divider'></span> <a class='pull-menu' href='#'></a><div class='no-tablet-portrait'><div class='element place-right'><a class='dropdown-toggle' href='#'><span id='spanUser'>刁静?2</span><span class='icon-user-2'></span></a><ul class='dropdown-menu place-right' data-role='dropdown'><li><a href='#'>密码修改</a></li></ul></div><span class='element-divider place-right'></span></div></div></div>');
This depends on the loading order of js files
This js file was introduced later than the UI framework js)
this js files were introduced later than the UI framework js)
<link href="css/UI.css" rel="stylesheet" /> <script src="js/UI.js"></script><body></body><script type="text/javascript">$("body").append()</script>
up `````
You can try to quote it before the body tag is closed, not necessarily in the head. Just like JS can be written anywhere.
You can try to quote it before the body tag is closed, not necessarily in the head. Just like JS can be written anywhere.