jQuery(document).ready(function(){ jQuery('#foo').on('click', function(){ jQuery('#bar').simulateClick('click'); }); }); jQuery.fn.simulateClick = function() { return this.each(function() { if('createEvent' in document) { var doc = this.ownerDocument, evt = doc.createEvent('MouseEvents'); evt.initMouseEvent('click', true, true, doc.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null); this.dispatchEvent(evt); } else { this.click(); // IE Boss! } }); }
Purpose:simulate click function,
i use for bind of dynamic load page.
沒有留言:
張貼留言