22

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

1

3 Answers 3

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

:)

That should do the trick :)

10

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

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

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

This will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.