2011-08-29 39 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

相關問題