i’m using ionic 1 , and i have frame contain multiple of input field , i need to set focus in next input when press ‘go’ button ?
and how can change keyboard ‘go’ label button to ‘next’ and ‘done’.
code used in first question , but not work
link : function(scope, elem, attrs) {
elem.bind(‘keydown’, function(e) {
var code = e.keyCode || e.which;
var elems;
if (code === 13) {
e.preventDefault();
try {
if (attrs.tabindex !== undefined) {
var currentTabeIndex = attrs.tabindex;
var nextTabIndex = parseInt(currentTabeIndex) + 1;
elems = document.querySelectorAll("[tabindex]");
for (var i = 0, len = elems.length; i < len; i++) {
var el = angular.element(elems[i]);
var idx = parseInt(el.attr(‘tabindex’));
if (idx === nextTabIndex) {
elems[i].focus();
break;
}
}
}
} catch (e) {
console.log('Focus error: ’ + e);
}
}
});
}