2011-08-29 54 views
1

Im试图设置它时,使用jquery cookie插件并获取unexpected string errorjquery cookie set引发意想不到的字符串错误

jQuery('#select').change(function() { 
    if(jQuery(this).val() == "defaultselect"){ 
     jQuery.cookie('mycookie':'123456789'); // This line throws the error 
    } 
    return false; 
}); 

回答

2

你有一个语法错误:应该,

jQuery('#select').change(function() { 
    if(jQuery(this).val() == "defaultselect"){ 
     jQuery.cookie('mycookie','123456789'); //`:` should be `,` 
    } 
    return false; 
}); 
+0

感谢好先生! – mrpatg

+0

非常欢迎您,很高兴为您效劳。 – Usman

相关问题