You need to use the Web Storage API. As this seems like a plugin you're building, I would wrap the Storage API methods and use a prefix to prevent interference with other scripts that may be running on the page (as I have done in the example below).
I've taken the liberty of expanding your example a bit to better demonstrate usage, and I've removed all of that jQuery nonsense.
Here's a demo showing it in action
const textResizePlugin = scope => {
if(!(scope instanceof Node)) {
throw new Error('Invalid scope supplied');
}
const style = scope.style;
const prefix = 'textResizePlugin_';
if(scope.classList.contains(`${prefix}active`)) {
throw new Error('Already initialized');
} else {
scope.classList.add(`${prefix}active`);
}
const storage = {
get: (key) => window.localStorage.getItem(prefix + key),
set: (key, val) => window.localStorage.setItem(prefix + key, val)
};
const setSize = size => {
storage.set('fontSize', size);
style.fontSize = size;
};
setSize(storage.get('fontSize'));
const resize = m => setSize(
(style.fontSize||"1.0em").replace(/[\d.]+/, num => +num + m * 0.2)
);
const html = `
<div id="${prefix}bar">
<button id="${prefix}less">-</button>
<button id="${prefix}more">+</button>
</div>
<style type="text/css">
#${prefix}bar {
background: rgba(200,200,200,0.3);
position: fixed;
font-size: 0px !important;
top: 0;
width: 100%;
padding: 5px;
text-align: right;
box-sizing: border-box;
}
</style>
`;
scope.insertAdjacentHTML('afterbegin', html);
const [less, more] = scope.querySelectorAll(`#${prefix}less, #${prefix}more`);
less.addEventListener('click', () => resize(-1));
more.addEventListener('click', () => resize(1));
};
textResizePlugin(document.body);