I have shown some data as a value in the form of a test as shown below and below.
Var test = "yellow, green"; Var storedTest = localStorage.setItem ("Test", JSON.stringify (test)); $ ('Body') App ('color:' + localStorage.getItem ('test')); Currently my html output
color: "yellow, green" but I want to be able What do I need to do to get it?
Ok you can do this:
$ (' Body '). ('': '') + '' '') is in that place (/, / g, '', color: ''), text ", color: Replace each comma with " (where double-quotation is part of the replacement string), as well as beginning with a 'color:' and a double-quotation end. If you want to get individual colors in an array so that you can process them in any other way you can:
var colorArray = JSON.parse (LocalStorage.getItem ('test')). the division (','); // ["yellow", "green"] demo (both):
No comments:
Post a Comment