Uncaught SyntaxError: missing ) after argument list,line21
一直说我21行少个括号,但是我没发现哪里有错
代码如下:
<script type="text/javascript">
$(document).ready(function() {
//1.创建与插入节点
//创建节点,函数$(html节点),函数中的参数就是html节点的字符串
var p = $("<p>我是p</p>")
console.log(p)
//内部插入
/**
append(content) 向选中的节点内部追加内容
prepend(content) 向选中的节点内部前置内容
appendTo(content) 把选中的元素追加到content内部
prependTo(content) 把选中的元素前置到content内部
**/
$(".append").click(fucntion() {
//创建节点
var p = $("<p>我是内部追加的p</p>")
//把p追加给box
$("#box").append(p)
})
$(".prepend").click(function() {
$("#box").prepend($("<p>我是内部前置的p</p>"))
})
//追加到与前置到
$(".appendTo").click(function() {
$("#box2 h1").appendTo($("#box1"))
})
$(".prependTo").click(function() {
$("#box2 h2").appendTo($("#box"))
})
/**
2.外部插入
after(content) 向选中的标签外部后方插入元素content
before(content)向选中的标签外部前方插入元素content
insertAfter(content) 将选中的元素插入到content元素的外部后方
insertbefore(content)将选中的元素插入到content元素的外部前方
**/
$(".after").click(function(){
$("#box").after($("<p>hello p</p>"))
})
$(".insertAfter").click(function(){
$(".box h2").insertAfter($("#box"))
})
})
</script>
<style type="text/css">
#box {
width: 100px;
height: 200px;
border: 2px solid red;
}
#box2 {
width: 100px;
height: 200px;
border: 2px solid green;
}
</style>
</head>
<body>
<button type="button" class="append">内部追加</button>
<button type="button" class="prepend">内部前置</button>
<div id="box"></div>
<button type="button" class="appendTo">追加到</button>
<button type="button" class="prependTo">前置到</button>
<div id="box2">
<h1>我是标题1</h1>
<h2>我是标题2</h2>
</div>
<button type="button" class="after">外部后方插入</button>
<button type="button" class="insertAfter">插入到外部后方</button>
</body>