The .item
click function works, but when I click the refresh button it does not work. Please help me. I tried to move the code in the head
tag and at the end of the body
but it does not work.
<button id="button" type="submit">Refresh</button>
<div id="demo">
<div class="item">
item 1
</div>
<div class="item">
item 2
</div>
<div class="item">
item 3
</div>
</div>
<script src="jquery.min.js"></script>
<script>
$(document).ready(function() {
$("#button").click(function() {
$("#demo").load(location.href + " #demo");
return false;
});
$(".item").click(function() {
$(this).css("background", "red");
});
});
</script>