Here is the Bin. I am trying to make an example of reloading the page by using location.reload() in the function refresh() and using onclick='refresh()' in a button. For some reason the page is not reloading.
The JS function:
function refresh() {
location.reload();
}
The HTML button:
<button onclick='refresh()'>Try Refreshing!</button>
Your refresh method is not in the global scope - it's enclosed within your document.ready.
Move it out from document.ready into it's own script tag.
<script>
function refresh() {
location.reload();
}
</script>
The edited bin
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