slideUp(); Slide up //Change the height attribute of the element until the height is 0 to hide the element
slideDown();
slideToggle();
fadeOut(); fade out // from opaque to transparent
fadeIn()
Add two toggle functions to a function to switch languages
You can apply multiple selectors to an element at the same time
Place the script tag at the bottom, just before
because scripts can cause a problem, they can block parallel downloads in the browser. Multiple images from different servers can be downloaded simultaneously. Once the browser encounters a <script> tag, it can no longer download multiple elements in parallel. <br>
Putting it below will help improve download speed</p>
<p>var msg = "high score :<strong>" pts "</strong>"<br>
//You can add html tags </p> to variables
<p>var discount = Math.floor((Math.random()*5) 5);//Output a number between 5-10<br>
//math.random(); Get a random number from 0-1<br>
//Math.floor(x); Get the largest integer less than x<br>
var discount_msg = "<p>Your Discount is " discount "%<p>";</p>
<p>alert(discount);//pop-up message</p>
<p>$("p").append("<strong>123</strong>");<br>
If<p>qwert</p><br>
After running, it will be <p>qwert<strong>123</strong></p></p>
<p>jquery variable name requirements<br>
It cannot start with a number, it is case-sensitive, it cannot have any mathematical operators, it cannot have spaces and punctuation. Can have underline, </p>
<p>$(*) selects every element on the page</p>
<p>$(".guess_box").click(function(){<br>
$(this).append("hahaha");<br>
})<br>
//When multiple elements hold the same class, and I only want to process the element I am currently operating on, I can use $(this) to call the object that is currently executing the method </p>
<p></p>
<div class="codetitle">
<span><a style="CURSOR: pointer" data="62779" class="copybut" id="copybut62779" onclick="doCopy('code62779')"><u>Copy code</u></a></span> The code is as follows:</div>
<div class="codebody" id="code62779">
<br>
<ol><br>
<li>1</li><br>
<li>2</li><br>
</ol><br>
$("#btnRemove").click(function(){<br>
$("li").remove();<br>
});<br>
$("li").remove();<br>
</div>
<p>jquery descendant selector</p>
<p></p>
<div class="codetitle">
<span><a style="CURSOR: pointer" data="40753" class="copybut" id="copybut40753" onclick="doCopy('code40753')"><u>Copy code</u></a></span> The code is as follows:</div>
<div class="codebody" id="code40753">
<br>
$("div p") selects all paragraph elements under div <br>
$("div div") selects all div elements under div <br>
$("div div img") selects all img elements under div <br>
</div>
<p>Two ways to bind events</p>
<p></p>
<div class="codetitle">
<span><a style="CURSOR: pointer" data="80274" class="copybut" id="copybut80274" onclick="doCopy('code80274')"><u>Copy code</u></a></span> The code is as follows:</div>
<div class="codebody" id="code80274">
<br>
$("#myElement").click(function(){<br>
alert("click");<br>
});<br>
$("#myElement").bind('click',function(){<br>
alert("click");<br>
});<br>
</div>
<p>onblur();lost focus</p>
<p>onchange()<br>
//If the element content changes, trigger a method </p>
<p></p>
<div class="codetitle">
<span><a style="CURSOR: pointer" data="61711" class="copybut" id="copybut61711" onclick="doCopy('code61711')"><u>Copy code</u></a></span> The code is as follows:</div>
<div class="codebody" id="code61711">
<br>
<html><br>
<head><br>
<script type="text/javascript"><br>
function upperCase(x)<br>
{<br>
var y=document.getElementById(x).value<br>
document.getElementById(x).value=y.toUpperCase()<br>
}<br>
</script>