Hi,
I have a lightbox with a user-input textbox.
I am trying to make the button function to run whenever the user presses “Enter” while typing in that specific textbox. (“enter” in a textbox triggers a button)
I looked it up in the API and here in the forum, but couldn’t find anything relevant. Any help?
Thanks!
You can run the same function when the Enter is pressed
Let’s say you have a function:
function clickAction() {
console.log("Clicked")
}
and you want to run it when the button is clicked or when the ENTER key is hit:
$w("#button1").onClick( (event) => {
clickAction();
})
$w("#input1").onKeyPress( (event) => {
let key = event.key;
if(key === "Enter") {
clickAction();
}
})
It is working very well. Thank you very much!!