`

jquery触发自定义事件并传参

阅读更多
$("input").bind("myevent",function(event,msg1,msg2){
			alert("msg1:"+msg1);
		})


		$("input").click(function(){
				$("input").trigger("myevent",["avalue","bvalue"])
			});
 

自定义事件

 

 

var Common = {};	
	Common.Dialog = function(config){};
	Common.Dialog.prototype = {
		height:310,
		init: function(){
			jQuery.event.trigger("submit");
		}
	};


var dlg = new Common.Dialog({height:200});
		$(dlg).bind("submit",function(){alert("submit event")});
		dlg.init();
 


 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics