When I press any key in my textarea, it looks like that e.keycode does not function properly. But it always triggers when I press any key in my textarea. Any help please ?
function d(e) {
var key = (e.keyCode);
if (key == 229) {
alert("hello");
return false;
}
}
<textarea id="msg" onkeyup="d(event)">
</textarea>
I'm not working on pc. Im testing this on android browser.
219
is the keyCode which need to be used
function d(e) {
var key = (e.keyCode);
if (key == 219) {
alert("hello");
return false;
}
}
<textarea id="msg" onkeyup="d(event)">
</textarea>
The keycode for {
is 219
. Some browser uses keycode
, some uses which
. There is also charCode
.
function d(e){
var key = e.which || e.keyCode || e.charCode || 0;
if (key == 219){
alert("hello");
return false;
}
}
<textarea id="msg" onkeyup="d(event)">
</textarea>
try this one
<!DOCTYPE html>
<html>
<body>
<input type="text" size="40" onkeypress="myFunction(event)">
<script>
function myFunction(event) {
var x = event.which || event.keyCode;
if(x == '122'){ alert('hello');}
}
</script>
</body>
</html>
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I am trying to sort array of objects based on an integer propertyWhen using lodash's method _
I am using a JS router for my new website projectThe router accepts an object: the Key is the URL address and the Value is a function that will get called when the address is reached
Toggling item and changing property's value is very common but I still write this kind of code
There is a button on webpageI want a load web page through a button using enter key