append()是追加,为什么会另起一行?如何接着原文追加
append()是追加,为什么会另起一行?如何接着原文追加?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>append()方法追加内容</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()方法追加内容</h3>
<span>哈哈哈</span>
<script type="text/javascript">
function rethtml() {
var $html = "<div id='test' title='hi'>我是调用函数创建的</div>"
return $html;
}
$("span").append(rethtml());
</script>
</body>
</html>
这是运行结果