close

How do I refresh a DIV content?

Hello Guys, How are you all? Hope You all Are Fine. Today we are going to learn How do I refresh a DIV content? in javascript. So Here I am Explain to you all the possible methods here.

Without wasting your time, Let’s start This Article.

How do I refresh a DIV content ?

  1. How do I refresh a DIV content?

    do I refresh a DIV content For div refreshing without creating div inside yours with same id, you should use this inside your function
    $("#yourDiv").load(" #yourDiv > *");

  2. do I refresh a DIV content

    do I refresh a DIV content For div refreshing without creating div inside yours with same id, you should use this inside your function
    $("#yourDiv").load(" #yourDiv > *");

Method 1

To reload a section of the page, you could use jquerys load with the current url and specify the fragment you need, which would be the same element that load is called on, in this case #here:

function updateDiv()
{ 
    $( "#here" ).load(window.location.href + " #here" );
}
  • Don’t disregard the space within the load element selector: + " #here"

This function can be called within an interval, or attached to a click event

Method 2

For div refreshing without creating div inside yours with same id, you should use this inside your function

$("#yourDiv").load(" #yourDiv > *");

Summery

It’s all About this article. Hope all method helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you? Thank You.

Leave a Comment