<! DOCTYPE html>
<meta charset= "UTF-8" >
<title></title>
<script src= "/jquery/jquery.js/jquery.1.11.3.min.js" ></script>
<script type= "Text/javascript" >
JQuery noconflict () method
$.noconfilict ();
jquery ("button"). Click (function () {
jquery ("P"). Text ("jquery is running! ");
});
JQuery noconflict () Method-01
var JQ = $.noconflict ();
JQ (document). Ready (function () {
JQ ("button"). Click (function () {
JQ ("P"). Text ("jquery is running! ");
});
JQuery noconflict () Method-02
$.noconflict ();
jquery ("button"). Click (function ($) {
jquery ("P"). Text ("jquery is running! ");
});
JQuery Syntax Examples
$ (document). Ready (function () {
$ ("button"). Click (function () {
$ (this). Hide ();
});
});
$ (document). Ready (function () {
$ ("button"). Click (function () {
$ ("P"). Hide ();
});
});
$ (document). Ready (function () {
$ ("button"). Click (function () {
$ (". Test"). Hide ();
});
});
$ (document). Ready (function () {
$ ("button". Click (function () {
$ ("#test1"). Hide ();
}));
});
Hiding-sliding-fading
$ (document). Ready (function () {
$ ("button"). Click (function () {
$ ("#div1"). FadeOut ();
$ ("#div2"). FadeOut ("slow");
$ ("#div3"). FadeOut (3000);
});
});
$ (document). Ready (function () {
$ ("P"). Click (function () {
$ (this). Hide ();
})
});
$ (document). Ready (function () {
$ (". Ex.hide"). Click (function () {
$ (this). Parents (". ex"). Hide ("slow");
});
});
$ (document). Rady (function () {
$ (". Flip"). Click (function () {
$ (". Pane1"). Slidetoggle ("slow");
});
});
$ (document). Ready (function () {
$ ("button"). Click (function () {
var div = $ ("div");
Div.animate ({height: ' 800px ', opacity: ' 0.4 '}, "slow");
Div.animate ({width: ' 400px ', opacity: ' 0.8 '}, "slow");
Div.animate ({height: ' 800px ', opacity: ' 0.4 '}, "slow");
Div.animate ({width: ' 400px ', opacity: ' 0.8 '}, "slow");
});
});
Changing the content of HTML elements
$ (document). Ready (function () {
$ ("button"). Click (function () {
$ ("P"). HTML ("Welcome to My home!");
});
});
Append content to HTML elements
$ (document). Ready (function () {
$ ("#btn1"). Click (function () {
$ ("P"). Append ("<b>appended text</b>.");
});
$ ("#btn2"). Click (function () {
$ ("Ol"). Append ("<li>appended item</li>");
});
});
</script>
<style type= "Text/css" >
Div.pane1,p.flip
{
margin:0px;
padding:5px;
Text-align:center;
Background:palegreen;
border:1px solid Greenyellow;
}
div.pane1{
height:120px;
Display:none;
}
</style>
<body>
<!--jQuery Noconflict () Method--
<p>this is a paragraph!</p>
<button>check the Jquery!</button>
<!--jQuery Syntax example--
<button type= "button" >click me!</button>
<p id = "Test1" >this is a paragraph!</p>
<p class= "Test" >this is another paragraph!</p>
<H1 class= "Test" >everything'll be ok!<!--hiding-sliding-fading-->
<p> demonstrates the fadeout () method with different parameters. </p>
<button> Click here to make three rectangles fade out respectively. </button>
<br><br>
<div style= "width:100px;height:100px;background-color:hotpink;" id = "DIV1" ></div>
<br>
<div style = "width:100px;height:100px;background-color:cornflowerblue;" id = "Div2" ></div>
<br>
<div style= "width:100px;height:100px;background-color:red;" id = "Div3" ></div>
<p>you Click Me, I'll disappear!</p>
<p>you Click Me, I'll disappear too.</p>
<p>me too!</p>
<div class= "Ex" >
<button class= "Hide" type= "button" >hide</button>
<p>
Contact Person: Mr. Zhang <br>
No. 100th North Third ring Road <br>
Beijing
</p>
</div>
<div class= "Ex" >
<button class= "Hide" type= "button" >hide</button>
<p>
Contact person:david<br>
No. No. 200, v Street <br>
New york
</p>
</div>
<div class= "Pane1" >
<p>you must try your best!</p>
<p>you is your sunshine!</p>
</div>
<p class= "Flip" > click here. </p>
<button type= "button" > Start animation </button>
<p> by default, all HTML elements are in a static position and cannot be moved, so if you want to manipulate the location, remember to first set the CSS position property of the element to relative, fixed, or absolute. </p>
<div style= "background-color:pink;height:100px;width:100px; Position:absolute; " ></div>
<br><br>
<!--changing the contents of HTML elements--
<p>this is a paragraph!</p>
<p>this is another paragraph!</p>
<button type= "button" > Please click me!</button>
<!--append content to HTML elements--
<p>this is a paragraph.</p>
<p>this is another paragraph.</p>
<ol>
<li>list Item 1</li>
<li>list Item 2</li>
<li>list Item 3</li>
</ol>
<button id= "BTN1" > Append text </button>
<button id= "btn2" > Append list Items </button>
</body>
2016/1/5 jquery