$('#test').on('change', function (event, a1, a2) {
console.log(event); //The event object is always passed as the first parameter to an event handler
console.log(a1); //aaa
console.log(a2); //bbb
});
//第二個陣列參數,可用來傳其它參數
$('#test').trigger('change', ['aaa', 'bbb']);
參考:
https://api.jquery.com/trigger/
https://stackoverflow.com/questions/16401538/passing-parameters-on-jquery-trigger
沒有留言:
張貼留言