Call a function on enter key press

后端 未结 5 1281
死守一世寂寞
死守一世寂寞 2020-12-14 14:46

How to call a function using knockout.js when enter key is pressed.. here is my code below.

ko.bindingHandlers.enterkey = {
init: function (element, valueAcc         


        
5条回答
  •  隐瞒了意图╮
    2020-12-14 15:07

    This worked for me, thanks to @DaafVader for most of it.

    in view

    
    

    in viewmodel

    var searchKeyUp = function (d, e) {
        if (e.keyCode == 13) {
            search();
        }
    }
    

提交回复
热议问题