What's new
HTML Forums | An HTML and CSS Coding Community

Welcome to HTMLForums; home of web development discussion! Please sign in or register your free account to get involved. Once registered you will be able to connect with other members, send and receive private messages, reply to topics and create your very own. Our registration process is hassle-free and takes no time at all!

How to make selected function permanent?

ur mama

New member
Can somebody help me? I just want to make sure that when the value is selected it is saved in the browser, whether it will be restarted or refreshed. For example, I choose "Sticky" and it will remain so until I choose "Absolute". When I choose "Absolute" it will remain so until I choose "Sticky," just to keep the selected value saved. I tried many codes and scripts, but unsuccessfully. I would be very grateful if you help me.

My code:
Code:
<div id="menu-sticky-right">
    <img style="cursor: pointer;" onclick="myFunction()" src="https://i.imgur.com/Ed3FO1w.png" width="15" height="15">&nbsp;&nbsp;&nbsp;
    <img style="cursor: pointer;" onclick="myFunction2()" src="https://i.imgur.com/MDg7ZDp.png" width="15" height="15">
    <script>
        function myFunction() {
            document.getElementById('menu-sticky').style.cssText = 'position: absolute;';
        }
    </script>
    <script>
        function myFunction2() {
            document.getElementById('menu-sticky').style.cssText = 'position: fixed;';
        }
    </script>
</div>
 
Back
Top