jquery's Prepend () method

Source: Internet
Author: User

Prepend () method definition and usage:

This method inserts the specified element at the beginning of the inside of the matching element.

The action of the Prepend () method is the same as the Prependto (), but it is syntactically different, although it looks the same in grammatical form.

Syntax structure:

$ (selector). prepend (content)

Parameter list:

Parameters Describe
Content Specifies the possible values for the content that is being inserted:
1.HTML code-for example ("<div></div>").
2. Existing elements-for example ($ (". Div1")).
3.function (index) function-defines the function that returns the enclosing element, and the index parameter receives the indexer position of the selector.
Selector The matching element to be inserted into the content.

Instance code:

<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><Metaname= "Author"content= "http://www.51texiao.cn/" /><title>Ant Tribe</title><styletype= "Text/css">Div{Height:200px;width:200px;Border:1px solid Green;}</style><Scripttype= "Text/javascript"src= "Mytest/jquery/jquery-1.8.3.js"></Script><Scripttype= "Text/javascript">$ (document). Ready (function(){  $("Button"). Click (function(){     $("Div"). prepend ("content to be added"); })})</Script></Head><Body><Div>Before you add content:</Div><Button>Click to view Effects</Button></Body></HTML>

The original address is: http://www.51texiao.cn/jqueryjiaocheng/2015/0613/4050.html

The most original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=5284

jquery's Prepend () method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.