Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 647 Bytes

2014-08-20-jquery-event-on.md

File metadata and controls

29 lines (22 loc) · 647 Bytes
layout date title
post
2014-10-31 01:04:47 +0800
jQuery-event-on

.on()

.on(event,[,selector][,data],handler)

重点在于这里有个 selector,这个 selector 是对前面选择器的一个细化,选择的是前面选择器的子元素。

好方法

    var option = "loading";
    var a = typeof option == "object" && option;
    var b = true && option;  // return "loading"
    var c = false && option; // return false;

Selector context is implemented with the .find() method; therefore:

    $( "li.item-ii" ).find( "li" ) 
 // is equivalent to 
    $( "li", "li.item-ii" ).