工具:
一、$.each()方法:迭代函數
$.each(collection, function(index, element))
function中,return true爲continue,return false爲break
二、$.extend()方法:將一個或多個對象內容合併到目標對象
覆蓋合併:$.extend(obj1, obj2)
遞歸合併:$.extend(true, obj1, obj2)
三、$.grep():過濾數組
$.grep(array, function(element, index){ return invert })
invert爲過濾條件
四、$.makeArray()方法:將一個類似數組的對象轉換爲數組
$.makeArray(obj)
、$.proxy()方法:用於改變函數的上下文
$.proxy(function, context, additionalArguments)
事件:
一、bind() 方法:將事件或函數綁定到元素
綁定單事件:$(selector).bind(event, data, function)
綁定多事件:$(selector).bind({even:function, event:function})
二、blur()方法:當元素失去焦點時觸發
$(selector).blur(function)
三、change()方法:當元素的值發生改變並失去焦點時觸發
$(selector).change(function)
四、click()方法:當單擊元素時觸發
$(selector).click(function)
五、dblclick()方法:當雙擊元素時觸發
$(selector).dblclick(function)
六、delegate()方法:爲指定元素的子元素添加一個或多個事件
$(selector).delegate(childSelector, event, data, function)
七、die()方法:移除元素中的所有或指定事件
$(selector).die(event, function)