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

  • Home
  • SEARCH
  • 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 3334418
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:54:11+00:00 2026-05-17T23:54:11+00:00

I have a construction that checks if a checkbox is checked (who can use

  • 0

I have a construction that checks if a checkbox is checked (who can use more words ‘check’ so close to each other? =)) when the document loads and if it’s checked, some rows in the table get hidden. It looks like this:

if (jQuery('#navbar_disabled').is(':checked')) {
        jQuery('#navbar_disabled').parents('tr').prev().hide();
        jQuery('#navbar_disabled').parents('tr').prev().prev().hide();
    }

I am sure there is a quick nice way to get rid of those 2 last ‘#navbar_disabled’ and use something like ‘this’ or whatever instead. I know I can use something like var navbar_checkbox_disabled=jQuery('#navbar_disabled') and deal with it but I am looking for a more cute solution, if it is there. Thanks.

UPDATE: Why I am asking for the other solution than just assigning it to a new variable is that I need to use it on many elements like this:

jQuery('#company_address_disabled, #sociallinks_disabled, #contacts_mail_disabled, #navbar_disabled')
  • 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-05-17T23:54:11+00:00Added an answer on May 17, 2026 at 11:54 pm

    Why not use it as a filter, which will make the jQuery object empty if it’s not checked:

    jQuery('#navbar_disabled:checked').parents('tr').prev().hide().prev().hide();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a windows form, and I have a class that checks a text
For my exception class i have a constructor that has multi arguments (...) which
Is it good practice to have a class constructor that uses default parameters, or
Some of my classes have final fields that are populated from the constructor as
I am constructing a large HTML document from fragments supplied by users that have
I have the following construction: typedef struct bucket { char *key; ENTRY *data; struct
I have an associative array (object) of the following construction var menu = new
Can an abstract class have a constructor? If so, how can it be used
I have a constructor like as follows: public Agent(){ this.name = John; this.id =
I have two constructor : function clsUsagerEmailUserName($nickName, $email) { $this->nickName = $nickName; $this->email =

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.