0

I call function JS in my HTML like that:

     <div style="width:99%;">
       <textarea rows="4"  name="xxx" id="xxx" dojoType="dijit.form.SimpleTextarea"
        onKeyPress="zzz(event);return false;" ><?php echo i18n("textareaEnterText");?></textarea>
     </div>

And i have a function JS zzz(event) like that :

function zzz(event){
var key = event.keyCode;
if (key == 13 && !event.shiftKey) {
   ...
}

In Chrome , it's working , but on Mozilla i have an error : " event is not defined"

Someone have an idea ?

gadjeel
  • 21
  • 2
  • 5
  • Take a look at [this answer](https://stackoverflow.com/a/6235715/7421571), it could help you. – Abrikot Jun 09 '17 at 12:14
  • Don't working for me ... :( – gadjeel Jun 09 '17 at 12:25
  • It's weird, because I have no problem with the lower case form of `ontkeypress`. Where is exactly your issue? On the definition of the function, on the call of the function, ...? – Abrikot Jun 09 '17 at 12:27
  • Call of the function i think , because if i delete the parameters "event" of my function the error not display... But function don't working – gadjeel Jun 09 '17 at 12:28
  • Could you provide us a full snippet of your code? It is possible that the bug comes from somewhere else. – Abrikot Jun 09 '17 at 12:32

1 Answers1

0

Try it with all lower case onkeypress:

<div style="width:99%;">
   <textarea rows="4"  name="xxx" id="xxx" dojoType="dijit.form.SimpleTextarea"
    onkeypress="zzz(event);return false;" ><?php echo i18n("textareaEnterText");?></textarea>
 </div>

JavaScript is case sensitive language and all events are lowercase so be careful

NoOorZ24
  • 2,914
  • 1
  • 14
  • 33