Skip to content Skip to sidebar Skip to footer

Refresh Div With Javascript Button

Creating an APP in dreamweaver. How do I make it so a particular DIV will reload/refresh when the user clicks a button.

Solution 1:

Consider You have a button with id refresh, and the div your want to reload has id div. Once your click on the button it will load the div with the following JQuery

 <input type='button' name ='click me' id="refresh" /

 <script>
   $(function() {
     $("#refresh").on("click", function() {
        $("#mydiv").load("index.html")
        returnfalse;
    })
  })
</script>

Solution 2:

In Jquery

 <button id="MyButton">Refresh</button>

$(document).ready(function () {
     $("#myButton").on("click", function () {
        $("#div").load("index.php")
     });
});

Solution 3:

Here is a simple example of how to reload the text in a DIV element:

http://www.w3schools.com/jquery/jquery_ajax.asp

Post a Comment for "Refresh Div With Javascript Button"