jquery 传递事件的自定义数据
整理一下
1.
<script type="text/javascript">
$(document).ready(function(){
$("input").select(function(e){
$("input").after("文本被选中!"+e.b);
});
var e = jQuery.Event("select",{a:1,b:"abc"});
$("button").click(function(){
$("input").trigger(e);
});
});
</script>
==================================
2.
<script type="text/javascript">
$(document).ready(function(){
$("input").select(function(e,msg){
$("input").after("文本被选中!"+msg);
});
$("button").click(function(){
$("input").trigger("select",["abc"]);
});
});
</script>
3.=================
<script type="text/javascript">
$(document).ready(function(){
$("input").select([a,b],function(e){
$("input").after("文本被选中!"+e.data[0]);
});
$("button").click(function(){
$("input").trigger("select");
});
});
</script>
测试:
http://www.w3school.com.cn/tiy/t.asp?f=jquery_event_trigger_object