javascript equivalent to jquery trigger method -
if equivalent jquery bind method, trigger method.
function bind( scope, fn ) { return function () { fn.apply( scope, arguments ); }; }
the code above post , looks same proxy method
you can comment on too
i have take jquery part out off framework, - relevant part
if (selector === '') { this.el.bind(eventname, method); } else { this.el.delegate(selector, eventname, method); } } } }); if (includes) result.include(includes); return result; }; exports.controller = mod; })($, window); var exports = this; var events = { bind: function(){ if ( !this.o ) this.o = $({}); this.o.bind.apply(this.o, arguments); }, trigger: function(){ if ( !this.o ) this.o = $({}); this.o.trigger.apply(this.o, arguments); } };
thanks
once crossed site how manually trigger events in javascript
// here basic generic trigger method function triggerevent(el, type) { if ((el[type] || false) && typeof el[type] == 'function') { el[type](el); } } // call on multiple objects @ time function resetfields() { triggerevent(document.getelementbyid('has-email'), 'onchange'); triggerevent(document.getelementbyid('other-field'), 'onclick'); triggerevent(document.geteleemntbyid('another-one'), 'onblur'); }
Comments
Post a Comment