oldrock
oldrock

Reputation: 871

How to append the data at the top of the div using jquery

i have some content in the div and i need to append some data at the top of the previous content inside that div by moving the remaining content down after a jquery function call.

thanks in advance

Upvotes: 22

Views: 27181

Answers (3)

user2198974
user2198974

Reputation: 21

if you are using ajax call and want to set content at the top of div simply use $('#divId').(AjaxContent);

This will work.

Upvotes: -1

StuperUser
StuperUser

Reputation: 10850

Use the prepend command: http://api.jquery.com/prepend/

$('#yourDivId').prepend(yourContent);

Upvotes: 10

Yngve B-Nilsen
Yngve B-Nilsen

Reputation: 9676

$("#mydiv").prepend(Data)

:)

That should do the trick :)

Upvotes: 64

Related Questions