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 6609373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:42:38+00:00 2026-05-25T19:42:38+00:00

I have checkboxes that toggle on/off select option values. This part works fine. Now

  • 0

I have checkboxes that toggle on/off select option values. This part works fine.

Now I want to “check” the check box after page load by default.

I tried .click() that checks the checkbox but doesn’t run the click code that is linked to it. Tested on firefox 6.0.2, Safari & Chrome. Any suggestion how to do so?

jsfiddle example is here or below

$(function(){

    $selectClone = $("select[name=db2_timestamp]").clone(true);
    $("input[name=hideit]").click(function(){
        var $this;
        $selectClone.find("option").attr("disabled", false);

        $("input[name=hideit]").each(function(){
            var value = $(this).attr('value');

            if($(this).is(":checked")){

                $selectClone.find("option").each(function(){
                    $this = $(this);
                    if($this.val().indexOf(value) != -1){
                        $this.attr("disabled", true);
                    }
                });
            }        
        })       

        var $select = $("select[name=db2_timestamp]")
        $select.children().remove();

        $selectClone.find("option:enabled").each(function(){
             $select.append($(this).clone(true));
         });
    });
    $("input[value=w]").click();
});
  • 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-25T19:42:38+00:00Added an answer on May 25, 2026 at 7:42 pm

    Move the hide/show bits into a function and call the function both in the click handler and in an initialize function. Fiddle here

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

Sidebar

Related Questions

I have a select all button on this page that works on other browsers
I have an html checkbox that controls a list of checkboxes. I want this
Hi There I need to get the names and values of checkboxes that have
I have a group of checkboxes that I only want to allow a set
I have that function: $(#tabela tr).toggle(function(){ $(this).addClass(zaznaczone); $(this).find( :checkbox).attr(checked, 1); },function(){ $(this).removeClass(zaznaczone); $(this).find( :checkbox).attr(checked,
In my game, I have a panelA that has checkboxes to toggle panels in
If i have 3 checkboxes that you can check for the transport available: Taxi,
We have an ASP.Net page that uses a checkbox to toggle between a list
I have 10 checkboxes that are scattered throughout a page and if any one
I have a set of checkboxes that an Admin can tick to give users

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.