How to assign the contents of an element to another element in jquery and JavaScript _jquery

Source: Internet
Author: User
Copy Code code as follows:

<span style= "FONT-SIZE:24PX;" >
</span>

Copy Code code as follows:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv=" Content-type " Content= "text/html; Charset=utf-8 "/>
<title> Untitled document </title>
<script src=" Jquery-1.9.0.min.js "></script>
<script>
$ (document). Ready (function () {
a=$ (" #p1 ") [0].innertext;
$ ("#p2") [0].innerhtml=a;

})
</script>
<script>
Window.onload=function () {
A=document.getelementbyid ("p 1 "). innertext;
document.getElementById ("P2"). Innerhtml=a;

}
</script>
<body>
<p id= "P1" Name= "This is now the title" > This is now the title </p>
<p I D= "P2" name= "This is the title" > This is the title </p>
</body>
Related Article

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.