Hi, I have been coding a little Js function that manipulates certains divs and elements. On firefox it works great, but it does not work in Chrome and halts all the Javascript. I simply don't find what is wrong. Could you be kind enough to let me know? Cookies were tested and work fine. Using Jquery. Thanks!
function RememberMe(addr, bycookie = false)
{
// Cookie name
cookiename = "LBETS";
// Should we reset?
reset = false;
changed = false;
// See if button pressed
if($(".star_"+ addr).hasClass("active"))
{
$('#recent_tx').addClass("table-striped");
$(".star_"+ addr).removeClass("active");
reset = true;
} else {
$(".favstar").removeClass("active");
}
// Iterate rows
$('#recent_tx tr').each(function(){
if($(this).hasClass(addr))
{
if(reset)
{
$(this).removeClass('warning');
} else {
$(this).addClass('warning');
changed = true;
}
} else {
$(this).removeClass('warning');
}
})
// Change class
if(changed)
{
$('#recent_tx').removeClass("table-striped");
$(".star_"+ addr).addClass("active");
setCookie(cookiename, addr, 20*365);
}
// Reset
if(reset)
{
delCookie(cookiename);
}
}
Invalid syntax:
function RememberMe(addr, bycookie = false)
You can't do assignment of defaults in the function signature.
Firefox's JS engine allows this syntax, and it is likely coming in some form to ECMAScript 6.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.