Thursday, October 29, 2015

Refresh/Auto div content in Jquery

In this below script, Refresh/Auto div content in Jquery, Javascript and html

Refresh/Auto div content in Jquery, Javascript and html
Every 3 seconds div refresh automatically

<script src="https://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
setInterval(function(){
$("#divletter").load('banners.html')
}, 3000);
});
</script>
<div id="divletter">Hi Buddy</div>


Click event triggered

$(document).ready(function(){
   $("#btnclick").click(function(){
      $("#divdata").html("result reloaded successfully");
   });
});


<div id="divdata">Primary content</div>
<input type="button" id="btnclick" value="Click Me"></input>

No comments:

Post a Comment