Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9298589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:21:41+00:00 2026-06-18T22:21:41+00:00

In the script below, I’m attempting to evaluate all checkbox items with class cb-checkURL

  • 0

In the script below, I’m attempting to evaluate all checkbox items with class “cb-checkURL” and if checked, I want to set the nearest “.wl-options” div to display:block via jQuery show().

However, I’m missing something, the .each is not doing the job. Any ideas?

jQuery(document).ready(function(){
    jQuery.each( ".cb-checkURL", function() {
        if(jQuery(this).attr("checked")){
            jQuery(this).parent().next(".wl-options").show();
        }
        else
        {
            jQuery(this).parent().next(".wl-options").hide();
        }
    });

    jQuery(".cb-checkURL").click(
        function(){
            jQuery(this).parent().next(".wl-options").toggle();
        });
})';

HTML SOURCE

<label class="wl-active">
    <input class="cb-checkURL" type="checkbox" name="wl[item-2][location][is_url]" checked="checked">&nbsp;URL
</label>
<div class="wl-options" style="clear:both;max-width:400px;display:none">
    <div class="cb-urls">
        <label title="Enter one url slug per line" for="wl[item-2][url][urls]"></label>
        <textarea name="wl[item-2][url][urls]" id="wl[item-2][url][urls]"></textarea>
    </div>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T22:21:42+00:00Added an answer on June 18, 2026 at 10:21 pm

    It could be much more simple:

    jQuery(document).ready(function(){
        var handler = function() {       
            jQuery(this).parent().next(".wl-options").toggle(jQuery(this).is(':checked'));        
        };
    
        jQuery(".cb-checkURL").click(handler).each(handler);          
    });
    

    JSFiddle: http://jsfiddle.net/jA4wS/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The script below is called when saving my app's options page. All options are
The script below should open all the files inside the folder 'pruebaba' recursively but
In the script below, I want to keep the initial value of htmlStrTOCpre static
The short bash script below list all files and dirs in given directory and
The script below should be exluding items that are assigned to the my-menu category.
The script below is used to hide a paragraph until all text fields inside
The script below adds items to an array when you click the link, and
The PowerShell script below will list out all shared folders (excluding hidden shared folders),
The script below illustrate my question: library(reshape2) set.seed(1) dummy.df <- data.frame(var_a=sample(letters[1:5],200,replace=TRUE), var_b=sample(1:5,200,replace=TRUE), stringsAsFactors=FALSE) temp1
the php script below select and elaborate one by one all .txt files contained

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.