javascript - jQuery: using localized variable -


i trying use jquery cookie in order show/hide div element.

var cexpiry = lu_ban_object.cexpiry;  jquery('.float_close').click(function () {                 jquery('.float_notice').fadetoggle('slow');                 jquery.cookie('noticevisibility', 'hidden', {                     expires: [cexpiry], //problem here                     path: '/'                 }); 

the expires: number , represents cookie expiry day. number being stored in array , localized, have assigned localized numebr cexpiry variable, not accepting brackets, [] have tried () , {} not working, +[cexpiry]+

i following error;

uncaught typeerror: object [object array] has no method 'toutcstring'  

how change data type number? according screenshot saved string.

jquery

expires needs date object or number. question, looks cexpiry number already, no need cast object or array wrapping in brackets.

cexpiry might stored string, if that's case can use parseint cast number: parseint(cexpiry, 10);

from documentation:

value can number interpreted days time of creation or date object


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -