.prependTo() Method

Syntax

.prependTo()

Description

The .prependTo() method is more or less similar to “prepend” which allows to insert or append content to the beginning of the specified element. The only difference is that in .prepend() syntax, selector precedes content and in .prependTo() content precedes selector. Below example clearly shows you how to append the content at the beginning of the element using .prependTo() function.

Example Code

Result:

Prepeneding to Text

jQuery Tutorial

This is .prependTo() jQuery



Ask Questions

Ask Question