How to set outerHTML with jQuery?

0 votes

I have a UserControl. Ex:

<div id="divItem">
some html
</div>

The ajax request return new html of this UC from server. Ex:

<div id="divItem">
    new html
</div>

I want to replace the old html by the new one. How could I do that?

Apr 27 in Java-Script by kartik
• 11,890 points
31 views

1 answer to this question.

0 votes

hello @kartik,

This is innterHTML because it's inside the div called divItem. It also looks like you want to replace the existing text (?)

If your returned new html is in a variable called results, you do this:

$('#divItem').html(results);

Thank You!!

answered Apr 27 by Niroj
• 23,950 points

Related Questions In Java-Script

0 votes
1 answer

How to manage a redirect request after a jQuery Ajax call?

Hii kartik, You can resolved this issue like ...READ MORE

answered Apr 27 in Java-Script by Niroj
• 23,950 points
73 views
0 votes
1 answer

How can I send a message to a particular client with socket.io?

Hii, You can try the code below: io.to(socket.id).emit("event", data); whenever ...READ MORE

answered Apr 27 in Java-Script by Niroj
• 23,950 points
73 views
0 votes
1 answer

How to use React Router with Laravel?

Hii Kartik, Create a route that maps everything ...READ MORE

answered Apr 29 in Java-Script by Niroj
• 23,950 points
99 views
0 votes
1 answer

How to access PHP session variables from jQuery function in a .js file?

Hello, You can produce the javascript file via ...READ MORE

answered Apr 29 in Java-Script by Niroj
• 23,950 points
210 views
+1 vote
1 answer

What is the relationship between angularjs Scope with controller/view?

Let us consider the below block: <div ng-controller="emp"> ...READ MORE

answered Jan 20 in Web Development by Niroj
• 23,950 points

edited Jan 21 by Niroj 70 views
0 votes
1 answer

What is data binding in AngularJS?

Data binding is synchronization of data between the ...READ MORE

answered Jan 23 in Web Development by Niroj
• 23,950 points
39 views
0 votes
1 answer

How can we avoid my php form from hacking?

Hii @kartik, If you want to know php ...READ MORE

answered Feb 13 in PHP by Niroj
• 23,950 points
66 views
0 votes
1 answer

How can you display the error messages?

Hey, In the HTML form, we add ...READ MORE

answered Feb 13 in PHP by Niroj
• 23,950 points
46 views
0 votes
1 answer

How to call jQuery UI Dialog with ASP.NET button postback?

Hello @kartik, To solve the problem with ASP:Button ...READ MORE

answered Apr 28 in Java-Script by Niroj
• 23,950 points
57 views
0 votes
1 answer

How to Abort Ajax requests using jQuery?

Hello kartik, Just use ajax.abort(). For example you could ...READ MORE

answered Apr 27 in Java-Script by Niroj
• 23,950 points
42 views