JQuery HTML操作
$(#id)
$(tagname)
$(.classname)
$("button").click(function(){效果代码片})
$("button").dbclick(function(){效果代码片})
$("button").mouseenter(function(){效果代码片})
$("button").mouseleave(function(){效果代码片})
$("button").on(“click”,效果函数名)
$("button").off(“click”)
$("button").off(“click”,效果函数名)
event.stopPropagation();
event.stopImmediatePropagation();
$(document).ready(function(){
$("button").click(function(){
console.log($("#text").text());
console.log($("#text").html());
console.log($("#ipt").val());
console.log($("a").attr("href"));
$("p").text("设置的新内容");
$("div").html("<a href='www.baidu.com'></a>");
$("input").val("输入框新内容");
$("a").attr({
"href":"wwww.google.com",
"id":"new_a"
);
});
$("p").append("new content")
var text1 = "<a href=‘baidu.com’>链接</a>"
$("p").append(text1);
$("p").prepend("new content")
var text2 = $("<a href=‘baidu.com’></a>").text("链接")
$("p").prepend(text2);
$("p").before("new content")
var text3 = document.createElement("a");
text3.innerHtml = "链接";
$("p").before(text3);
$("p").after("new content")
$("p").empty();
$("p").remove();
});