开发者

Jeditable: muliple events

how can we implement a multip开发者_运维百科le event in jeditable, i want to bind two events for a certain div, like dblclick and Enter key

$('.edit').editable('some.php', {
        event     : "dblclick",
        tooltip   : "Double click or press Enter Key to edit..."
    });

thanks


Well obviously, this is a property managed by the jEditable script, so your only solution would be to dig in jEditable.js and add another possibility for the event property, which would include the events of your liking ;)

GL - I'm about to do just the same right now. - I'll post some info when I'm done.

Ok so it was pretty easy --

Two changes in the jquery.jeditable.mini.js

find and replace :

$(this).bind(settings.event,function(e){if(true===$(this).data('disabled.editable')){return;}

with

var eventlist=settings.event.split(',');$(this).bind(eventlist[0],function(e){if(true===$(this).data('disabled.editable')){return;}

And then, at the end of the bound function -->

find and replace

$(self).attr('title',settings.tooltip);return false;});});

with

for(z=1;z<eventlist.length;z++){
var funcname_of_no_collide_doom=eventlist[0];
$(this).bind(eventlist[z],function(){$(this)[funcname_of_no_collide_doom]();});

}

And tadaam you just need to set the event property using a list of valid jQuery events, like event : 'dblclick,click,blur,tomato'

Actually that mod was funny ... but the real simple solution is offered by jQuery directly :

http://api.jquery.com/bind/

rtfm --

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜