javascript - Knockout change the click event -


i'm trying find way change click event on elements. want think how ko binds click event attached element , changing function has no effect.

viewmodel.clickevent = function(item){    logic }  viewmodel.clickevent = newfunction;  <div data-bind="click: clickeevent">mybutton</div> 

i think need use delegates having hard time figuring out how this. post basic example of how knockout?

if have understood right. create fake event handler can modify without modifying actual event handler binded view.

var viewmodel = {     clickevent : function(item){         if(this.changableclickevent)             this.changableclickevent(item);     },     changableclickevent : null }  viewmodel.changableclickevent = function(){     // logic     alert('logic'); }  ko.applybindings(viewmodel); 

see fiddle


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -