<button onclick="abc()" class="btn btn-warning">clear</button>
<hr>
<ul class="list-group">
</ul>
</div>
</div>
</div>
</div>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script>
function save(){
var key = $(".insert #key").val()
var value = $(".insert #value").val()
localStorage.setItem(key,value)
//select()
}
function select(){
let str = ''
for(var i = 0;i < localStorage.length;i ++){
var key = localStorage.key(i)
var value = localStorage.getItem(key)
str +=`
<li>
key: <span>${key}</span>
value: <span>${value}</span>
<button data-key='${key}'>delete</button>
</li>
`
}
$(".select ul").html(str)
}
function abc(){
localStorage.clear()
$(".select ul").html("")
}
$(".select ul").delegate(".delete",'click',function () {
console.log(1)
var key = $(this).data("key")
localStorage.removeItem(key)
$(this).parent().remove()
})
</script>
</body>