<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(function() {
$("<div><p>Hello</p></div>").appendTo("body")
$("<input type='checkbox' />").appendTo("body")
$("<div>", {
"class": "test",
text: "Click me!",
click: function() {
$(this).toggleClass("test");
}
}).appendTo("body")
$("<input>", {
type: "text",
val: "Test",
focusin: function() {
$(this).addClass("active");
},
focusont: function() {
$(this).removeClass("active")
}
}).appendTo("body")
})
</script>
</head>
<body>
</body>
</html>
jQuery动态写HTML
最新推荐文章于 2021-06-05 01:00:01 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)