How to enable the input field when it comes to onfocus

 I have used 4 input field, whenever i enter the value it should be focused to the next input field. Likewise when i give backspace it focus to the previous one. I used javascript, it was focusing to the next input field but it is not working for backspace.

SyntaxEditor Code Snippet

function backspace(){
var key = event.which||event.keyCode||event.charCode;
if(key==8){
 document.querySelector(".in1").focus();
}
else{
 document.querySelector(".in3").focus();
}
}

Hi Ellakkiya,

Did you receive any errors in your browser console when you are pressing backspace?

If not, are you able to go inside your function while pressing backspace in your application? I suggest yo to add some debugger or console.log() to investigate in which javascript line you are getting issue.

Let me know if you need some more information on this.

Regards

Solution

Hi Ellakkiya,

I have attached the OML file, which contains the required javascript for changing focus. Check it and let me know if you need any more help on this.

Solution

Palak Patel wrote:

Hi Ellakkiya,

Did you receive any errors in your browser console when you are pressing backspace?

If not, are you able to go inside your function while pressing backspace in your application? I suggest yo to add some debugger or console.log() to investigate in which javascript line you are getting issue.

Let me know if you need some more information on this.

Regards

Thankyou for your reply.,

No I didn't receive any error. I will  add debugger and investigate my javascript.


Pravi Gupta wrote:

Hi Ellakkiya,

I have attached the OML file, which contains the required javascript for changing focus. Check it and let me know if you need any more help on this.

Thankyou Pravi.,

Its working.