append()是追加,為什么會(huì)另起一行?如何接著原文追加
append()是追加,為什么會(huì)另起一行?如何接著原文追加?
<!DOCTYPE?html> <html?xmlns="http://www.w3.org/1999/xhtml"> ????<head> ????????<title>append()方法追加內(nèi)容</title> ????????<script?src="http://libs.baidu.com/jquery/1.9.0/jquery.js"?type="text/javascript"></script> ????????<link?href="style.css"?rel="stylesheet"?type="text/css"?/> ????</head> ???? ????<body> ????????<h3>append()方法追加內(nèi)容</h3> ????????<span>哈哈哈</span> ????????<script?type="text/javascript"> ????????????function?rethtml()?{ ????????????????var?$html?=?"<div?id='test'?title='hi'>我是調(diào)用函數(shù)創(chuàng)建的</div>" ????????????????return?$html; ????????????} ????????????$("span").append(rethtml()); ????????</script> ????</body> </html>
2016-07-09
在CSS中加入
#test,h3 {
??? display:inline;
}
2016-07-05
<script type="text/javascript">
? ? ? ? ? ? function rethtml() {
? ? ? ? ? ? ? ? var $html = "<span id='test' title='hi'>我是調(diào)用函數(shù)創(chuàng)建的</span>"
? ? ? ? ? ? ? ? return $html;
? ? ? ? ? ? }
? ? ? ? ? ? $("h3").append(rethtml);
? ? ? ? </script>
這樣就對(duì)了
2016-06-30