Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Event is not defined" in firefox

HTML Code which calls a function on a level select event. This code is written in Ember framework.

{{ action "onLevelSelect" this on="change" target= "view"}}

Javascript function which is called by triggering this event:

onLevelSelect : function(event) {
    var getSelectedLevel = event.target.selectedOptions[0].label;   // error line

    /*rest of the code goes below*/
}

When it comes to "error line", i m getting this error.

"ReferenceError: event is not defined".

I have tried window.event and event.which and i also tried by sending event explicitly to the function "onLevelSelect".

like image 454
Saravanan Avatar asked Nov 26 '25 08:11

Saravanan


1 Answers

I solved this problem but forgot to update. The Solution is

Firefox doesn't support the ember handlebar syntax to handle events like Click, Change etc. But it works in Chrome. So, I used jQuery functions to handle these events like click(event){}, change(event){}, etc.(we can also use HTML functions like onClick(), onChange()) .

like image 75
Saravanan Avatar answered Nov 27 '25 21:11

Saravanan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!