You need to sign in to do that
Don't have an account?
Amit Singh 2236
Lightning code to track caps lock on and off Functionality in login form page
Lightning code to track caps lock on and off Functionality in login form page
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
I have gone through your issue and found a solution. Please check the link below -
https://salesforce.stackexchange.com/questions/264943/detecting-caps-lock-not-working/264951#264951
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
I've gone through your requirement and you can use the below javascript code:
It should not be onkeypress, but should be onkeyup.
In theory, the keydown and keyup events represent keys being pressed or released, while the keypress event represents a character being typed.
The implementation of the theory is not same in all browser
<span onkeyup="{!c.keyCheck}">
<lightning:input aura:id="capsLock" label="test" />
</span>
Js:
({
keyCheck : function(component, event, helper) {
// Caps Lock numeric value: 20
console.log(event.which);
if (event.which == 20) {
var capsLockMessage = component.find("capsLockMessage");
$A.util.toggleClass(capsLockMessage, "slds-hide");
alert("Caps Lock was pressed");
}
}
})
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com