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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:31:29+00:00 2026-06-15T01:31:29+00:00

I have a function openbag(); for opening div. this div is also open on

  • 0

I have a function openbag(); for opening div. this div is also open on click and addClass “active”. but i am open this div from server side, call the function openbag();. but the problem is this div is open every time when refresh the other page. I have removed “active” class and check if class has not but this is always showing. here is my code i am using.

function openBag() {
   $("#bag").addClass("active");
   $("#expanding-bag").slideDown("fast");
  }


$(document).ready(function () {
    if ($("div#bag").hasClass("active")) {
        $("#expanding-bag").show();
        $("#bag").removeClass("active");
    }

    else {
        $("#expanding-bag").hide();
    }

in c# :

Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script language='javascript'>openBag();</script>");
  • 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-15T01:31:30+00:00Added an answer on June 15, 2026 at 1:31 am

    You can avoid open it and close it and all that, and direct manipulate the javascript from code behind. One trick is to use Literal and show it or not, and place inside of it the code as:

    <asp:Literal runat="server" id="ShowIt" Visible="false" EnableViewState="false">
    $(document).ready(function () {
        $("#expanding-bag").show();    
    }
    </asp:Literal>
    
    <asp:Literal runat="server" id="HideIt" Visible="false" EnableViewState="false">
    $(document).ready(function () {
        $("#expanding-bag").hide();
    }
    </asp:Literal>
    

    and on code behind you make ShowIt.Visible=true; in the one you wish to run.

    Other way is to direct render this code on page from code behind.

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

Sidebar

Related Questions

I have function LoadTempMovieList(), and need to load movies from sessionStorage. But it seems
I have simple from written on C/gtk+ and i have function in this appliction.
I have function named: - (void) AddSortedCustomFeed :(NSMutableArray*) rssList; this function adds items(Articles) from
I have function like this: function ypg_delete_img($id, $img) { $q = $this->ypg_get_one($id); $imgs =
I have function Start() that is fired on ready. When I click on .ExampleClick
I have function like this: function gi_insert() { if(!IS_AJAX){ $this->load->library('form_validation'); $this->form_validation->set_rules('name', 'Naslov', 'trim|required|strip_tags'); $this->form_validation->set_rules('body',
i have function to send mail with attachment to microsoft exchange server. My problem
i have function like this. function load($name, $arg1, $arg2, $arg3, $arg4){ $this->$name = new
I have function defined this way: def f1 (a, b, c = None, d
i want to have function like delete file from database by using link instead

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.