admin管理员组文章数量:1278952
I created a function in Javascript
function addName(okDelete = true){
amountExtraStudents++;
if(amountExtraStudents > 2){
preisAktuell = 60;
}
if(!okDelete){
jQuery('#teilnehmerExtra').append('<div class="teilnehmer-1"></div>');
}else{
jQuery('#teilnehmerExtra').append('<div class="teilnehmer-2"></div>');
}
eintragNummer++;
updateButtons();
}
I created a function in Javascript
function addName(okDelete = true){
amountExtraStudents++;
if(amountExtraStudents > 2){
preisAktuell = 60;
}
if(!okDelete){
jQuery('#teilnehmerExtra').append('<div class="teilnehmer-1"></div>');
}else{
jQuery('#teilnehmerExtra').append('<div class="teilnehmer-2"></div>');
}
eintragNummer++;
updateButtons();
}
But in Edge I get this error:
In Safari I dont get any Error - but the Function - and all the other functions in the rest of the Script Block are not working.
It works out fine in Chrome, Firefox and Opera, but not in Safari, IE and Edge...
Is there something inpatible with the Browser?
Share Improve this question asked May 24, 2016 at 15:16 Niklas RieckenNiklas Riecken 2992 gold badges7 silver badges20 bronze badges 6- Why you have an expression as parameter? – Simon Schüpbach Commented May 24, 2016 at 15:17
- In ES6 it's good stuff, but anything before that it's no good. @SimonSchüpbach – Albzi Commented May 24, 2016 at 15:18
- Isnt that giving the possibility to set a "standard" value, if no parameter is given? – Niklas Riecken Commented May 24, 2016 at 15:18
- Should only work in Chrome or FF, surprised it works in Safari? developer.mozilla/en-US/docs/Web/JavaScript/Reference/… – chiliNUT Commented May 24, 2016 at 15:18
- @chillNUT - it doesnt work in Safari! Any work Around? – Niklas Riecken Commented May 24, 2016 at 15:19
1 Answer
Reset to default 10The error is occuring when you use the 'default parameters' feature introduced in ES6. Edge does not support it.
An ES5 version would be:
function addName(okDelete){
if (typeof okDelete === "undefined") {
okDelete = true;
}
You might also consider using a tool such as Babel to transpile your ES6 into ES5.
本文标签: internet explorerJavascript Function not working in EdgeStack Overflow
版权声明:本文标题:internet explorer - Javascript Function not working in Edge - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741274464a2369647.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论