Examples of jquery simple events

Source: Internet
Author: User

jquery event is simpler than JS, especially the number of code is obviously more abbreviated, here are two examples of jquery events, one is the full select event, one is the navigation bar mouse over the Remove event:

One, select All events:

"Content-type"Content="text/html; Charset=utf-8"/><script src=".. /.. /.. /phpstudy/www/jquery-3.2.0.min.js"></script><title> Untitled Document </title>"checkbox"Value="QX"Id="QX"/> Select </div><br/><div><input type="checkbox"Value="1" class="ck"/>Lu Fei<input type="checkbox"Value="1" class="ck"/>Sauron<input type="checkbox"Value="1" class="ck"/>Shan Zhi<input type="checkbox"Value="1" class="ck"/>na mei<input type="checkbox"Value="1" class="ck"/>Usopp<input type="checkbox"Value="1" class="ck"/>Frankie</div></body><script type="Text/javascript">$("#qx"). Click (function () {//find selection of the Select All button//var XZ = $ (this) [0].checked;        varXZ = $ ( This). Prop ("checked"); //Change all checkbox selection status$(". CK"). Prop ("checked", XZ); })</script>

Second, move the mouse over the navigation bar to remove the event

<style>. a{width:50px;    height:20px; float: Left;    margin:10px; }</style><script src="Jquery-3.2.0.min.js"></script>class="a"> Home </div><divclass="a"> Shiji </div><divclass="a"> Chinese Book </div><divclass="a"> Later Han book </div><divclass="a"> Kingdoms </div></body><script>$(". A"). MouseOver (function () {$ ( This). CSS ("Background-color","#666")//turn Gray after clicking})$(". A"). Mouseout (function () {$ ( This). CSS ("Background-color","#FFF")//change to White after removal})    </script>

Examples of jquery simple events

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.