Use jquery to get content and properties for content _jquery

Source: Internet
Author: User

Copy Code code as follows:

<! DOCTYPE html>
<meta charset= "Utf-8" >
<title></title>
<script src= "Js/jquery.js" ></script>
<style>
body{font-family: "Microsoft Ya hei"; width:980px; margin:0 auto; text-align:center;}
. box{
width:300px;
height:300px;
Background:green;
border:1px solid #e6e6e6;
line-height:200px;
Position:absolute;
}
button{
Border:none;
Background:green;
width:125px;
height:50px;
line-height:50px;
Color: #fff;
font-size:16px;
margin-top:50px;
font-family: "Microsoft Ya Hei";
}
</style>
<body>
<button id= "BTN1" > Show text</button>
<button id= "BTN2" > Show html</button>
<button id= "BTN3" > Display input </button>
<p id= "Text" > This is to show <b> bold </b> rhythm </p>
<br/>
<input id= "input" value= "buy a House" >
<script>
$ (document). Ready (function () {
$ ("#btn1"). Click (function () {
Alert ("Text:" + $ ("#text"). Text ());
});
$ ("#btn2"). Click (function () {
Alert ("HTML:" + $ ("#text"). html ());
});
$ ("#btn3"). Click (function () {
Alert ("Value:" +$ ("#input"). Val ());
});
});
</script>
</body>

Tips:

1, click the Event node selection #botton

2. Alert's code rule ("Value:" + $ ("#id"). html)

Today's sharing is here first, and we will continue to update some of the new jquery instances.

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.