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
jQuery append() MethodThe append() method inserts specified content at the end of the selected elements. Tip: To insert content at the beginning of the selected elements, use the prepend() method.
First, select the div element which need to be copy into another div element. Select the target element where div element is copied. Use the append() method to copy the element as its child.
You can use the . appendChild() method in JavaScript to add or append an element to the body section of a document or a web page. The body property (in the above example) sets or returns the document's (the web page) body element.
append() & . prepend() .append() puts data inside an element at the last index; while. . prepend() puts the prepending element at the first index.
$("#mydiv").prepend(Data)
:)
That should do the trick :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With