jquery - Removing event handler with .off -


i unable remove event handler using .off boxes.

once box clicked need event handler removed box, have made hook ".clickable" , remove class , tried remove event handler apply event handler boxes class of ".box".

        $('.clickable').off('click','**').on("click", function(event){          if( !$('.box').is(':animated') ) {              var position = $(this).position()             ,   targetposition =  $('.target').position();              $(this)                 .clone() //clone element                 .addclass('cloned') //add class cloned element                 .css({                     'position' : 'absolute'                 ,   'top' : position.top                  ,   'left' : position.left                  })                 .appendto('body'); //append document                  animate(position,targetposition);                  $(this)                     .removeclass('clickable')                     .addclass('notactive');          };      }); 

thanks advice , help, if see final demo "working" here fiddle

working version

correction code, haven't tested should work

$(document).on("click", '.clickable', function(event){     if( !$('.box').is(':animated') ) {         var position = $(this).position();         var targetposition =  $('.target').position();         $(this)             .clone() //clone element             .addclass('cloned') //add class cloned element             .css({                 'position' : 'absolute'             ,   'top' : position.top              ,   'left' : position.left              })             .appendto('body'); //append document             animate(position,targetposition);             $(this)                 .removeclass('clickable')                 .addclass('notactive')                 .off('click');     }; });  

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -