jQurery学习笔记
参考:菜鸟教程https://www.runoob.com/jquery/jquery-tutorial.html
jquery效果
$(“button”).click(function(){
$("#div1").fadeIn();/为块div1添加淡入淡出效果/
});
iQuery捕获
$("#btn1").click(function(){
alert(“Text: " + $(”#test").text());/通过alert获得id为test的文本并返回/
});
alert(“HTML: " + $(”#test").html());/通过alert获得id为test的html并返回/
alert($("#runoob").attr(“href”));/获得attr所指定的属性的值/
alert(“值为: " + $(”#vall").val());/获得vall表单的字段value/
jquery捕获并修改
$("#btn3").click(function(i,origText){
return "旧文本: " + origText + " 新文本: Hello world! (index: " + i + “)”; /获取test1的文本并通过回调函数对其进行修改/
});
$("#test2").html("<b>Hello world!</b>");/*获取test2的html并对其进行修改*/
$("#test3"