Skip to content Skip to sidebar Skip to footer

Action With Multiple Attribute Selector Jquery

I am trying to use a keyboard to enter numeric values. My problems is the following: the keyboard has a button 'Accept' and I have several text fields, I want to add for each text

Solution 1:

Since the component you are using does not expose any event for accept and cancel, an external solution is needed. For example, you can save the current element on focus, and use that inside the accept button event.

Demo:http://jsfiddle.net/W2xFX/27/

Code:

var currentKB = null;
$('input[type=text]').focus(function() {
    currentKB = this;
    returntrue;
});

$('input[type=text]').keyboard({
    layout: "num"
});

$('.ui-keyboard').on('click', 'input[name="key_accept"]',function(e, x) {
    alert('Accept button was clicked in ' + currentKB.id);
    // do your stuff here
});

Solution 2:

http://jsfiddle.net/W2xFX/35/

You just have to keep track of the active text box (the last one focused on).

Post a Comment for "Action With Multiple Attribute Selector Jquery"