I would like to add two properties to the body tag from two different cookies.
One to change the text size and the other to alter the background image displayed.
The script below works but when I add the background cookie to the script it overwrites the text size style set.
Is it possible to add more than one property to the body tag on document.ready or is there a better way to do this?
$(document).ready(function() {
if (($.cookie('text-sizer') != null)) {
$('body').attr("style",$.cookie('text-sizer'));
}
});
Instead of directly accessing (and overwriting) the ‘style’ attribute, use instead the css method.
Your code would look like this then (assuming you just had a pt/px value in the ‘text-sizer’ cookie):