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.