"Learn to light it" jQuery DOM operations-get content and properties

Source: Internet
Author: User

jquery has a powerful way to manipulate HTML elements and attributes.

A very important part of this is the ability to manipulate the DOM.

dom--the Document Object model.

1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <MetaCharSet= "Utf-8">5 <Scriptsrc= "Https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></Script>6 <Scripttype= "Text/javascript">7     $(function(){8         $("#btn1"). Click (function(){9 Alert ("Text:"+$("#test"). text ());Ten         }) One         $("#btn2"). Click (function(){ A Alert ("HTML:"+$("#test"). HTML ()); -         }) -         $("#btn3"). Click (function(){ the Alert ("values:"+$("#test2"). Val ()); -         }) -         $("#btn4"). Click (function(){ - Alert ("href Value:"+$("#a1"). attr ("href")); +         }) -     }) + </Script> A </Head> at  - <Body> -     <PID= "Test">This is in the paragraph<b>Bold</b>Text.</P> -     <P>Name:<inputtype= "text"ID= "Test2"value= "You and I, he learns." /></P> -     <P><ahref= "Www.nwtxxb.com"ID= "A1">You and me, he learns.</a></P> -     <ButtonID= "Btn4">Displays the value of the href attribute</Button> in     <ButtonID= "Btn3">Show Values Value</Button> -     <ButtonID= "BTN1">Display text</Button> to     <ButtonID= "BTN2">Display HTML</Button> + </Body> - </HTML>

"Learn to light it" jQuery DOM operations-get content and properties

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.