jQuery prepend and prependTo example

Previous
Next
In this post,  we are going to see jQuery prepend and prependTo methods.

Both do the same task, insert text or html before content of every selected elements, so it will put text or html to first index of selected element. Both methods add text or html as a child to selected elements .Syntax is quite different for for prepend and prepend to nethod.
Syntax for prepend() :

inserting using prepend

Syntax for prependTo() :

inserting using prependTo

Let’s understand with the help of example:

Live demo: JS Bin on jsbin.com

Previous
Next

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.

Add Comment

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.
You can like our facebook page Java2blog