jquery - knockoutjs single and double click -


i want able bind single , double click event span of text. know can use

data-bind ="event: { dblclick: dosomething } 

for double click, need ability perform different function on single click. suggestions?

first, wouldn't recommend click binding @ all. instead should use "click" , "dblclick" handlers jquery:

$(someparentelement).on('click', 'your span selector', function (event) {     var myviewmodelfragment = ko.datafor(this);     // code here });  $(someparentelement).on('dblclick', 'your span selector', function (event) {     var myviewmodelfragment = ko.datafor(this);     // code here }); 

edit: see niko's suggestion regarding supporting both single , double clicks. basically, you should count number of clicks manually , call different functions accordingly. assumed jquery handles but, unfortunately, doesn't.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -