Jquery each controls the display or hiding of checkbox-related content (table tr) (jquery hides the output content according to conditions)

Source: Internet
Author: User


If you do not select any option, the content of all countries is displayed. If you select one option, the content of each country can be added. Uncheck this option to hide the corresponding content; "Others" indicates all countries not in the selected list. 1. jquery function check () {var country = ""; $ ("[name = 'checkbox']"). each (function () {if ($ (this ). attr ("checked") {country + = $ (this ). val () ;}}); $ ("# tableID tr "). each (function () {$ (this ). show (); if (country! = "" & Country. indexOf ("other") <0) {if (country. indexOf ($ ("td: eq (1)", this).html ()> = 0) {} else {$ (this ). hide () ;}} else if (country = "") {$ (this ). show ();} else {if (country. indexOf ($ ("td: eq (1)", this).html ()> = 0) {$ (this ). show ();} else if ($ ("td: eq (1)", this).html ()! = "Us" & $ ("td: eq (1)", this example .html ()! = "UK" & $ ("td: eq (1)", this).html ()! = "France" & $ ("td: eq (1)", this example .html ()! = "Germany" & $ ("td: eq (1)", this).html ()! = "Region" & $ ("td: eq (1)", this).html ()! = "Japan" & $ ("td: eq (1)", this).html ()! = "Switzerland" & $ ("td: eq (1)", this example .html ()! = "Australia" & $ ("td: eq (1)", this).html ()! = "Canada" & $ ("td: eq (1)", this).html ()! = "China") {$ (this ). show ();} else {$ (this ). hide () ;}}); $ ("# tableID tr: eq (0 )"). show () ;}2. asp page <div class = "CurBlock">

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.