JQUERY check if localstorage item exists jquery - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution
join us

check if localstorage item exists jquery


 1801

Show ResultJQUERY


5

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js " type="text/javascript"></script>
</head>
<body>

<input type="text" id="input1" placeholder="put some text"></br>
<button id="btn4">set session storage</button>
<button id="btn5">remove</button>

<script type="text/javascript">

$(document).ready(function () {

if (!window.sessionStorage) {
document.write("not supported!");
}

if (sessionStorage.getItem("session_storage") != null) {
$("#input1").val(sessionStorage.getItem("session_storage"));
}

$("#btn4").click(function () {
var value = $("#input1").val();
sessionStorage.setItem("session_storage", value);
alert("now refresh your page");
});

$("#btn5").click(function () {
sessionStorage.removeItem("session_storage");
});

});

</script>

</body>
</html>


By        
The power of the user (%)
80%



The most helpful JQUERY solutions

plugin get client ip address using jqueryplugin get client ip address using jqueryJQUERY

Click to see more ...

  10.4K     1.8K

How to get client machine name or computer name with jquery?How to get client machine name or computer name with jquery?JQUERY

Click to see more ...

  15.5K     793

plugin detect country jqueryplugin detect country jqueryJQUERY

Click to see more ...

  5.5K     772

cookie jquerycookie jqueryJQUERY

Click to see more ...

  3.7K     398

plugin convert thousands to K jqueryplugin convert thousands to K jqueryJQUERY

Click to see more ...

  3.2K     402

show position on google map jqueryshow position on google map jqueryJQUERY

Click to see more ...

  2.5K     389

how to create a jquery plugin for converting date to days ago, month ago and year ago ?how to create a jquery plugin for converting date to days ago, month ago and year ago ?JQUERY

Click to see more ...

  2.6K     349

How to detect the version of IE browser using jquery ?How to detect the version of IE browser using jquery ?JQUERY

Click to see more ...

  2.5K     338

How to get top, right, left, bottom position of element div using jquery ?How to get top, right, left, bottom position of element div using jquery ?JQUERY

Click to see more ...

  2.6K     296

how to get ip address using jquery ?how to get ip address using jquery ?JQUERY

Click to see more ...

  2.4K     286

Welcome aboard!
We are happy you are here and
wish you good net-raft!