$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
$("p").hide() 隱藏所有<p>
$(".test").hide() 隱藏所有class="test"
$("#test").hide() 隱藏所有id="test"
$("p.intro") 選取所有class="intro"的<p>
$("p#demo") 選取id="demo"的第一個<p>
$("[href]") 選取所有帶href屬性
$("[href!='#']") 選取所有帶href屬性值不等於#
$("[href$='.jpg']") 選取所有帶href屬性值以".jpg"結尾
$("p").css("background-color","red");
$("ul li=first") 選取每個ul的第1個li元素
$("div #intro .head") 選取id="intro"的div所有class="head"
---------------------------------------------------------------------------------------------------
.ready(function)
.click(function) .dblclick(function)
.focus(function) .blur(function)
.mouseover(function) .mousedown(function)
.html(content) 改變元素內部html
.append(content) 向被選取元素的(內部)html追加內容
.prepend(content) 向被選取元素的(內部)html預置(Prepend)內容
.after(content) 向被選取元素的(內部)html之後添加html
.before(content) 向被選取元素的(內部)html之前添加html
http://www.w3school.com.cn/jquery/jquery_ref_events.asp
原始文章出自於此
沒有留言:
張貼留言