今天做一個項目,遇到了一個問題,是以前沒有遇到過的,就此記上一筆。
1、trigger方法解釋
官方是這么解釋的:
用法:
.trigger( eventType [, extraParameters] )
其中eventType包含javascript內置的事件、jQuery增加的事件和自定義事件。例如:
- $('#foo').bind('click', function()
- {
- alert($(this).text());
- });
- $('#foo').trigger('click');
- $('#foo').bind('custom', function(event, param1, param2)
- {
- alert(param1 + "/n" + param2);
- });
- $('#foo').trigger('custom', ['Custom', 'Event']);
新聞熱點
疑難解答
圖片精選