Sara
Sara

Reputation: 1

ionic keyboard go button to next button

Reference:Change go button to next button in android

I am developing an application with sign up page using Ionic framework.

Is there any option to replace go button with next button? I want to move cursor from one field to another using next button in the keyboard.

Upvotes: 0

Views: 1787

Answers (1)

Yogeshwar Tanwar
Yogeshwar Tanwar

Reputation: 417

you can use following reference to achieve your requirement in ionic.Below code is for cordova

    (function($) {
    $.fn.enterAsTab = function(options) {
        var settings = $.extend({
            'allowSubmit': false
        }, options);
        this.find('input, select, textarea, button').live("keypress", {localSettings: settings}, function(event) {
            if (settings.allowSubmit) {
                var type = $(this).attr("type");
                if (type == "submit") {
                    return true;
                }
            }
            if (event.keyCode == 13) {
                var inputs = $(this).parents("form").eq(0).find(":input:visible:not(disabled):not([readonly])");
                var idx = inputs.index(this);
                if (idx == inputs.length - 1) {
                    idx = -1;
                } else {
                    inputs[idx + 1].focus(); // handles submit buttons
                }
                try {
                    inputs[idx + 1].select();
                }
                catch (err) {
                    // handle objects not offering select
                }
                return false;
            }
        });
        return this;
    };
})(jQuery);

For adding next button , you can refer following link: How to add Next button in Ionic soft keyboard plugin

Upvotes: 1

Related Questions