I've had a problem with my code for a few hours now. When you press the button its activates the function, but when I call the function with onkeypress it tells me it is not defined.
I've already tried to put it in a normal function if you can say, I've tried to put it in global with window.myfunction = myfunction
<div>
<input onkeypress="if(event.keyCode==13){test();}" id="number" type="text" placeholder="Tapez un nombre pour commencer">
<input type="button" value="Envoyer" class="btn">
<div>
$(function(){
$(".btn").click(function click(){
// reste du code
});
})
I would like the same action to be done when you press the enter key as when you press the button (activate the click function)