Question

I have a problem

My php file

<div id='1'><input type='text' onkeyup="comment('<?php echo $_SESSION["id"] ?>', e)"> 
</div>

My javascript file

function comment(id, e){alert(id); // WORK
alert(e.keyCode); //DOES NOT WORK}
Était-ce utile?

La solution

Change your code to :

onkeyup="comment(event,'your string')"> 

function comment(e,id) {
  var comment = $(".blabla").val();
  // alert(message);  WORK
  alert(e.keyCode);
 }
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top