Can I constantly change the value and label of the html button?

I am making a simple personal control system that tracks what you did yesterday based on the actions (buttons) that you pressed. Actions (buttons) should be editable, which I can do easily with jquery, but I want it to be constantly changed, even if I reload the page.

<div id='action-container'> <div class='actions'> <button id='action1' class="action" data-value="Wash Dishes">Wash Dishes</button> <button>Edit Button 1</button></div> </div> 

if there is a way how can i do this?

+4
source share
2 answers

If you want to save the state on the server, you can save the state in a hidden field accessible to the server and access this field during postback and save the state in which you want. If you want to keep state on the client, you can use client storage

In html

 <input type="hidden" runat="server" id="hdnstate" /> 

In javascript

 document.getElementById('<%= hdnstate.ClientId %>').value = "stateinfo"; 

In the code below

 string strState = hdnstate.Value; 
+1
source

You can use cookies (for small pieces of information) or (in modern browsers) the local storage where the -side state client is stored (in the browser).

For centralized storage, you need to either save it on your own server or integrate with something like Google Apps , which has a rich API and feature set, or DropBox , or any of several others.

+1
source

All Articles