How to detect keypress 'Enter'?

2 posts, 1 answers
  1. Garling
    Garling avatar
    8 posts
    Member since:
    May 2014

    Posted 14 Jan 2015 Link to this post

    I have a modalview with two data-bind buttons, "click: enter" and "click: close". I also have a textbox data-bind "value: BtscannedCust". 

    In my js file:

    window.BTscanView = kendo.observable({
            enter: function () {
                var that = this;
                customerScanDataSource.add({ scanned: this.BtscannedCust });
                document.getElementById("BtscannedCust").value = "";
                var text_input = document.getElementById("BtscannedCust");


            close: function () {
                this.BtscannedCust = "";

    I need to detect a 'Enter" keypress in the textbox and then fire the "enter: function".

  2. Answer
    Tsvetina avatar
    2085 posts

    Posted 19 Jan 2015 Link to this post

    Hello Garling,

    Have you tried using the keypress event as suggested in this Stack Overflow thread?
    How to detect enter key

    I tested it on a device on my side and it worked as expected. Here is how I defined the input on my side:
    <input data-bind="events: {keypress: enter}" />


    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

Back to Top