Skip to content

Dynamically Change Key Text #524

@hslorenzo

Description

@hslorenzo

Hi,

Is there a way to change a key (or action key) text dynamically? What I'm trying to do is to change the key text of {next] button to 'Submit' when last input box is in focus.
Here is my js code:

$.keyboard.keyaction.next = function (base) {
      var parent_fieldset = $('#' + base.el.name).parents('fieldset');
      var $prevInput = $('#' + parent_fieldset.attr("id") + ' input:eq(-2)');     
     
     //If 2nd to the last input is in focus
      if ($prevInput.attr("id") == base.el.name) {

              setTimeout(function () {
                  var keyboard = $('.keyboard-normal').keyboard().getkeyboard();
                  keyboard.options.display.next = 'Submit';
                  //keyboard.redraw();
                  $('.ui-keyboard-next').find("span:contains('Go')").text('Submit');
              }, 500);
       }
      

      base.switchInput(true, base.options.autoAccept);
      return false;

  };

It seems to work but when my mouse exited the button the text reverts back to 'Next'.

Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions