JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <input class="input" value="99.97" data-id="20" />
  <button class="button">Сохранить значение в Cookie</button>
  
  <script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js" async></script>
</body>
</html>

JavaScript

// Библиотека для Cookie
// https://www.npmjs.com/package/js-cookie

const saveUserValue = () => {
	const input = document.querySelector('.input');
  const button = document.querySelector('.button');

  const value = Cookies.get('input-value');

  if (typeof value === 'string') {
  	input.value = value;
  }
 
 	button.addEventListener('click', () => {
  	Cookies.set('input-value', input.value, {
    	expires: 1,
    });
  });
};

saveUserValue();