This should work right? I have not a clue as to why it's not. I have to be doing something wrong.
<div id="randomdiv">text</div>
<a id="refresh">click</a>
<script>
$(function() {
$("#refresh").click(function() {
$("#randomdiv").load("index.php")
})
})
</script>
Use this. $('#mydiv'). load(document. URL + ' #mydiv');
The answer is definitely yes, but you will need to write javascript code for it. We can use a click handler on the div element to make it clickable.
You can use event. preventDefault() to prevent the default event (click) from occurring.
What happen if you do this?
<a id="refresh" href="#">click</a>
<script>
$(function() {
$("#refresh").click(function(evt) {
$("#randomdiv").load("index.php")
evt.preventDefault();
})
})
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With