hcl
hcl

Reputation: 1

Translating YUI to jQuery functionality

I am totally new to jquery and I need to migrate some code from YUI to jquery. Need some help to start off with this.Please help translating the following piece of YUI code to jquery.

for ( var i = 0; i < objs.length; i++) {
    var o = objs[i];
    (function(obj, args, type, fn) {
        YAHOO.util.Event.on(obj, type, function() {
            fn.run(obj, args)
        });
    })(o.obj, o.args, this._type, this);
}

Thanks

Upvotes: 0

Views: 335

Answers (1)

Robert Koritnik
Robert Koritnik

Reputation: 105029

This inner part of you code:

YAHOO.util.Event.on(obj, type, function() {
   fn.run(obj, args)
});

should most likely be replaced with:

$(obj).bind(type, function() {
    fn.run(obj, args);
});

But the code largely depends on the data supplied as obj and type. You should read this jQuery documentation about event types.

Upvotes: 2

Related Questions