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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:30:00+00:00 2026-05-27T17:30:00+00:00

I am working on a project in which I have two DIVs (DIV1, DIV2),

  • 0

I am working on a project in which I have two DIVs (DIV1, DIV2), both have no. of text boxes which are creating dynamically.
I have to hide one of the DIV. On another DIV click event I am showing these DIVs accordingly and enter some text in those textboxes of DIV1. When I hide this div1 and show the DIV2 and enter some text in some textboxes of the DIV2 and hide it. When I show the DIV1 the textboxes are empty. I want these textboxes to retain their values that I entered before I hide it. The same occurs with DIV2 as well.
All these operations are doing by jquery and I need help in jquery.

Can any body help me please.
Thanks in Advance.

  • 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-27T17:30:01+00:00Added an answer on May 27, 2026 at 5:30 pm

    Try code similar as below:

    <html>
    <head>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
    <style>
    .container{
    border:1px solid gray;
    margin:10px;
    }
    p,input{margin:10px;}
    </style>
    <script type="text/javascript">
     $(document).ready(function(){
        $("#p1").click(function(){ $("#div2").toggle();});
        $("#p2").click(function(){ $("#div1").toggle();}); 
     });
    </script>
    </head>
    <body>
    <div class="container">
    <p id="p1">Text in block2</p>
    <div id="div1">
        <input type="text" value="Some text in div 1" class="c1" />
        <input type="text" value="Some text in div 1" class="c1" />
    </div>
    </div>
    <div class="container">
    <p id="p2">Text in block1</p>
    <div id="div2">
      <input type="text" value="Some text in div 2" class="c2" size="20"/>
      <input type="text" value="" class="Some text in div 2" size="20"/>
    </div>
    </div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project which shall contain two targets. One for building a
I have two maven projects A and B, both of which I'm actively working
I'm working on a project which stores single images and text files in one
I am working on an iPhone project which I have translated to two languages
I am working on a project which contains two servers, one is written in
I'm working on a project in which we have a database, data layer (entity
I'm working on a project which will end up have a lot of application
I have just begun working on a project which uses Mercurial as a version
I have started working on a project which requires Natural Language Processing. We have
Suppose you're working on an enterprise project in which you have to get management

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.