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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:09:10+00:00 2026-05-30T19:09:10+00:00

I implemented some code (below) to check the state of ContentID and hide or

  • 0

I implemented some code (below) to check the state of ContentID and hide or show a DIV:

        <select id="ContentID" name="ContentID">
          <option selected="selected" value="00">Menu</option>
          <option value="01">Topic</option>
        </select>
        <input id="htmlEdit" type="checkbox" />

        $("#ContentID")
            .val($.cookie("ContentID_dropdown"))
            .change(function () {
                if ($(this).val() == "00")
                    $("#htmlSwitch").show();
                else
                    $("#htmlSwitch").hide();
                $.cookie("ContentID_dropdown", $(this).val(), { expires: 365, path: '/' });
                refreshGrid("Content");
            });

This code works BUT only when the value of ContentID changes. What I need is something that will also check the value after the value has been changed with a cookie.

The code in the change function that checks .val() does not check anything or run when the initial value is set with a cookie. So if my cookie is for example set to Topic then it is ignored and the htmlSwitch DIV appears when it should not. Is there a way that I could make it check the initial value and also hide or show the htmlSwitch id?

  • 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-30T19:09:11+00:00Added an answer on May 30, 2026 at 7:09 pm

    What if you triggered it immediately after the change is bound?

    $("#ContentID")
            .val($.cookie("ContentID_dropdown"))
            .change(function () {
                if ($(this).val() == "00")
                    $("#htmlSwitch").show();
                else
                    $("#htmlSwitch").hide();
                $.cookie("ContentID_dropdown", $(this).val(), { expires: 365, path: '/' });
                refreshGrid("Content");
            })
            .trigger('change');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Implemented some barbuttons by using below code, UISegmentedControl *button = [[[UISegmentedControl alloc] initWithItems: [NSArray
I implemented some code using backbone.js in Asp.NEt MVC3 and found backbone.js very helpful.
I was just trying out some code, not a experienced coder. I implemented(at least
I found some code from the msdn site (Code included below), which looks like
I've been using FB Connect for some time now. The code below has worked
I want to implement some code in excel macro to group some data for
I am trying to implement some code on my web page to auto-scroll after
I was going to implement some code which needs a synchronized data structure. I
Looking at Thrift and Google Protocol Buffers to implement some quick RPC code. Thrift
I have some code that I absolutely must implement using goto . For example,

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.