$(dd).bind(click,function(e){
var $obj = $(e.target);
var i=0;
for (var x in $obj){
i++;
var $hr=(i%5==0) ? : ;
document.write(x+ +$hr);
}
});
遍历结果:
0 length prevobject context selector
--------------------------------------------------------------------------------
constructor init jquery size toarray
--------------------------------------------------------------------------------
get pushstack each ready eq
--------------------------------------------------------------------------------
first last slice map end
--------------------------------------------------------------------------------
push sort splice extend data
--------------------------------------------------------------------------------
removedata queue dequeue delay clearqueue
--------------------------------------------------------------------------------
promise attr removeattr prop removeprop
--------------------------------------------------------------------------------
addclass removeclass toggleclass hasclass val
--------------------------------------------------------------------------------
bind one unbind delegate undelegate
--------------------------------------------------------------------------------
trigger triggerhandler toggle hover live
--------------------------------------------------------------------------------
die blur focus focusin focusout
--------------------------------------------------------------------------------
load resize scroll unload click
--------------------------------------------------------------------------------
dblclick mousedown mouseup mousemove mouseover
--------------------------------------------------------------------------------
mouseout mouseenter mouseleave change select
--------------------------------------------------------------------------------
submit keydown keypress keyup error
--------------------------------------------------------------------------------
find has not filter is
--------------------------------------------------------------------------------
closest index add andself parent
--------------------------------------------------------------------------------
parents parentsuntil next prev nextall
--------------------------------------------------------------------------------
prevall nextuntil prevuntil siblings children
--------------------------------------------------------------------------------
contents text wrapall wrapinner wrap
--------------------------------------------------------------------------------
unwrap append prepend before after
--------------------------------------------------------------------------------
remove empty clone html replacewith
--------------------------------------------------------------------------------
detach dommanip appendto prependto insertbefore
--------------------------------------------------------------------------------
insertafter replaceall css serialize serializearray
--------------------------------------------------------------------------------
ajaxstart ajaxstop ajaxcomplete ajaxerror ajaxsuccess
--------------------------------------------------------------------------------
ajaxsend show hide _toggle fadeto
--------------------------------------------------------------------------------
animate stop slidedown slideup slidetoggle
--------------------------------------------------------------------------------
fadein fadeout fadetoggle offset position
--------------------------------------------------------------------------------
offsetparent scrollleft scrolltop innerheight outerheight
--------------------------------------------------------------------------------
height innerwidth outerwidth width
再遍历:
复制代码 代码如下:
$(dd).bind(click,function(e){
var $obj = $(e.target);
var i=0;
for (var x in $obj[0]){
i++;
var $hr=(i%5==0) ? : ;
document.write(x+ +$hr);
}
});
遍历结果:
queryselector queryselectorall scrolltop scrollleft scrollheight
--------------------------------------------------------------------------------
scrollwidth clienttop clientleft clientheight clientwidth
--------------------------------------------------------------------------------
firstelementchild lastelementchild previouselementsibling nextelementsibling childelementcount
--------------------------------------------------------------------------------
children classlist setcapture getelementsbyclassname getclientrects
--------------------------------------------------------------------------------
getboundingclientrect releasecapture mozmatchesselector addeventlistener removeeventlistener
--------------------------------------------------------------------------------
dispatchevent style contenteditable iscontenteditable offsetparent
--------------------------------------------------------------------------------
innerhtml offsetleft offsettop offsetheight offsetwidth
--------------------------------------------------------------------------------
scrollintoview id title lang dir
--------------------------------------------------------------------------------
classname accesskey blur focus click
--------------------------------------------------------------------------------
tagname removeattributens removeattribute getattribute getelementsbytagname
--------------------------------------------------------------------------------
setattribute getelementsbytagnamens hasattributens setattributens hasattribute
--------------------------------------------------------------------------------
getattributens nodename nodevalue nodetype parentnode
--------------------------------------------------------------------------------
childnodes firstchild lastchild previoussibling nextsibling
--------------------------------------------------------------------------------
attributes ownerdocument namespaceuri prefix localname
--------------------------------------------------------------------------------
baseuri textcontent setuserdata getuserdata insertbefore
--------------------------------------------------------------------------------
replacechild removechild appendchild haschildnodes clonenode
--------------------------------------------------------------------------------
normalize issupported hasattributes comparedocumentposition issamenode
--------------------------------------------------------------------------------
lookupprefix isdefaultnamespace lookupnamespaceuri isequalnode getattributenode
--------------------------------------------------------------------------------
setattributenode removeattributenode getattributenodens setattributenodens element_node
--------------------------------------------------------------------------------
attribute_node text_node cdata_section_node entity_reference_node entity_node
--------------------------------------------------------------------------------
processing_instruction_node comment_node document_node document_type_node document_fragment_node
--------------------------------------------------------------------------------
notation_node document_position_disconnected document_position_preceding document_position_following document_position_contains
--------------------------------------------------------------------------------
document_position_contained_by document_position_implementation_specific hidden tabindex draggable
--------------------------------------------------------------------------------
spellcheck dataset
于是用$(dd)[0].tagname 可以获得tagname.
参考:http://www.mkyong.com/jquery/jquery-how-to-get-the-tag-name/
然后与$(a)遍历的结果对比
复制代码 代码如下:
$(a).bind(click,function(e){
var $obj = $(e.target);
var i=0;
for (var x in $obj){
i++;
var $hr=(i%5==0) ? : ;
document.write(x+ +$hr);
}
});
遍历结果:
0 context length constructor init
--------------------------------------------------------------------------------
selector jquery size toarray get
--------------------------------------------------------------------------------
pushstack each ready eq first
--------------------------------------------------------------------------------
last slice map end push
--------------------------------------------------------------------------------
sort splice extend data removedata
--------------------------------------------------------------------------------
queue dequeue delay clearqueue promise
--------------------------------------------------------------------------------
attr removeattr prop removeprop addclass
--------------------------------------------------------------------------------
removeclass toggleclass hasclass val bind
--------------------------------------------------------------------------------
one unbind delegate undelegate trigger
--------------------------------------------------------------------------------
triggerhandler toggle hover live die
--------------------------------------------------------------------------------
blur focus focusin focusout load
--------------------------------------------------------------------------------
resize scroll unload click dblclick
--------------------------------------------------------------------------------
mousedown mouseup mousemove mouseover mouseout
--------------------------------------------------------------------------------
mouseenter mouseleave change select submit
--------------------------------------------------------------------------------
keydown keypress keyup error find
--------------------------------------------------------------------------------
has not filter is closest
--------------------------------------------------------------------------------
index add andself parent parents
--------------------------------------------------------------------------------
parentsuntil next prev nextall prevall
--------------------------------------------------------------------------------
nextuntil prevuntil siblings children contents
--------------------------------------------------------------------------------
text wrapall wrapinner wrap unwrap
--------------------------------------------------------------------------------
append prepend before after remove
--------------------------------------------------------------------------------
empty clone html replacewith detach
--------------------------------------------------------------------------------
dommanip appendto prependto insertbefore insertafter
--------------------------------------------------------------------------------
replaceall css serialize serializearray ajaxstart
--------------------------------------------------------------------------------
ajaxstop ajaxcomplete ajaxerror ajaxsuccess ajaxsend
--------------------------------------------------------------------------------
show hide _toggle fadeto animate
--------------------------------------------------------------------------------
stop slidedown slideup slidetoggle fadein
--------------------------------------------------------------------------------
fadeout fadetoggle offset position offsetparent
--------------------------------------------------------------------------------
scrollleft scrolltop innerheight outerheight height
--------------------------------------------------------------------------------
innerwidth outerwidth width
再遍历:
复制代码 代码如下:
$(a).bind(click,function(e){
var $obj = $(e.target);
var i=0;
for (var x in $obj[0]){
i++;
var $hr=(i%5==0) ? : ;
document.write(x+ +$hr);
}
});
遍历结果:
jquery16407028609993839658 queryselector queryselectorall scrolltop scrollleft
--------------------------------------------------------------------------------
scrollheight scrollwidth clienttop clientleft clientheight
--------------------------------------------------------------------------------
clientwidth firstelementchild lastelementchild previouselementsibling nextelementsibling
--------------------------------------------------------------------------------
childelementcount children classlist setcapture getelementsbyclassname
--------------------------------------------------------------------------------
getclientrects getboundingclientrect releasecapture mozmatchesselector addeventlistener
--------------------------------------------------------------------------------
removeeventlistener dispatchevent style contenteditable iscontenteditable
--------------------------------------------------------------------------------
offsetparent innerhtml offsetleft offsettop offsetheight
--------------------------------------------------------------------------------
offsetwidth scrollintoview href rel target
--------------------------------------------------------------------------------
name text search hash id
--------------------------------------------------------------------------------
title lang dir classname accesskey
--------------------------------------------------------------------------------
blur focus click tagname removeattributens
--------------------------------------------------------------------------------
removeattribute getattribute getelementsbytagname setattribute getelementsbytagnamens
--------------------------------------------------------------------------------
hasattributens setattributens hasattribute getattributens nodename
--------------------------------------------------------------------------------
nodevalue nodetype parentnode childnodes firstchild
--------------------------------------------------------------------------------
lastchild previoussibling nextsibling attributes ownerdocument
--------------------------------------------------------------------------------
namespaceuri prefix localname baseuri textcontent
--------------------------------------------------------------------------------
setuserdata getuserdata insertbefore replacechild removechild
--------------------------------------------------------------------------------
appendchild haschildnodes clonenode normalize issupported
--------------------------------------------------------------------------------
hasattributes comparedocumentposition issamenode lookupprefix isdefaultnamespace
--------------------------------------------------------------------------------
lookupnamespaceuri isequalnode tabindex element_node attribute_node
--------------------------------------------------------------------------------
text_node cdata_section_node entity_reference_node entity_node processing_instruction_node
--------------------------------------------------------------------------------
comment_node document_node document_type_node document_fragment_node notation_node
--------------------------------------------------------------------------------
document_position_disconnected document_position_preceding document_position_following document_position_contains document_position_contained_by
--------------------------------------------------------------------------------
document_position_implementation_specific getattributenode setattributenode removeattributenode getattributenodens
--------------------------------------------------------------------------------
setattributenodens ping hreflang type protocol
--------------------------------------------------------------------------------
host hostname port pathname charset
--------------------------------------------------------------------------------
coords rev shape hidden draggable
--------------------------------------------------------------------------------
spellcheck dataset
jquery get tag name
复制代码 代码如下:
jquery get tag name
jquery get tag name
this is paragrah 1
this is class='classtag1'
this is id='idtag1'