JQuery unbinding a specific handler -


given code below, how can unbind('click', h) work?

it doesn't work. make h global variable don't know how "set up" given msg variable set within function.

??

function x(open) {     var msg = "blah";      var h = function (e) {         e.preventdefault();         showdialog(msg);     };      if (open === true) {         but.unbind('click');         link.unbind('click');     } else {         but.click(h);         link.click(h);     }     } 

msg = "blah"  h = function(e)  {      e.preventdefault();     showdialog(msg); };  function x(open)  {     msg = "whatever";      if (open === true)      {         but.unbind('click', h);         link.unbind('click', h);     }      else      {         but.click(h);                link.click(h);           } } 

*i think


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -