jquery for all-in-select inverse function

Source: Internet
Author: User

Nonsense not to say, directly on the code!

<HTML><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"><Scripttype= "Text/javascript"src= "Jquery-3.1.1.min.js"></Script><title>Insert Title here</title></Head><Body><Divstyle= "margin:20px;">Select all:<inputtype= "checkbox"ID= "SelectAll"onclick= "Selects1 ()">    </Div><Divstyle= "width:600px;height:40px;border:1px solid #ccc">Multi Box 1:<inputtype= "checkbox"class= "Check_class">Multi Box 2:<inputtype= "checkbox"class= "Check_class">Multi Box 3:<inputtype= "checkbox"class= "Check_class">Multi Box 4:<inputtype= "checkbox"class= "Check_class">Multi Box 5:<inputtype= "checkbox"class= "Check_class">Multi Box 6:<inputtype= "checkbox"class= "Check_class"></Div><BR><Scripttype= "Text/javascript">/** Method 1 works on both the computer and the local computer. * Method 2 works on the computer only one function, that is, check the selection, after the reverse election. Check again and no longer works. The local PC works as normal * may be due to the jquery version issue? The working computer jquery version is the 1.11 series. This is 3.1.1 .*/    //Implementation Method 1    functionselects1 () {//full selection, reverse selection function        varSelectstatus= $('#selectAll'). Is (': Checked'); $('. Check_class'). each (function(){            $( This). Prop ('checked', Selectstatus);    }); }        //Implementation Method 2    functionselects2 () {//full selection, reverse selection function        varSelectstatus= $('#selectAll'). Is (': Checked'); $('. Check_class'). each (function(){            $( This). attr ('checked', Selectstatus);    }); }        </Script></HTML>

jquery for all-in-select inverse function

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.