Dlaczego to działa w jsfiddle, ale nie w moim dokumencie
Znalazłem wspaniałe jsfiddle, które ktoś zrobił i chciał wykorzystać część tego w moim projekcie:
http://jsfiddle.net/manuel/29gtu/
Działa na jsfiddle, ale nie w moim dokumencie HTML. Oto, co w moim dokumencie:
<!DOCTYPE html>
<html>
<head>
<script src="scripts/jquery-1.7.2.js"></script>
<script>
$("button").click(function() {
var id = $("#id").val();
var text = "icon-"+id;
// update the result array
var result = JSON.parse(localStorage.getItem("result"));
if(result == null)
result = [];
result.push({id: id, icon: text});
// save the new result array
localStorage.setItem("result", JSON.stringify(result));
// append the new li
$("#bxs").append($("<li></li>").attr("id", "item-"+id).html(text));
});
// on init fill the ul
var result = JSON.parse(localStorage.getItem("result"));
if(result != null) {
for(var i=0;i<result.length;i++) {
var item = result[i];
$("#bxs").append($("<li></li>").attr("id", "item-"+item.id).html(item.icon));
}
}
</script>
</head>
<body>
<ul id="bxs" class="tabs">
</ul>
<input type="text" id="id" /><button>save</button>
</body>
</html>
Kod jest kopiowany i wklejany z skrzypce. Myślę, że ma to związek z tym, że nie mam wtyczki do przechowywania lokalnego. Aby to jsfiddle działało, czy potrzebuję jakiejś zewnętrznej wtyczki, której brakuje?