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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:19:12+00:00 2026-06-16T05:19:12+00:00

I am creating a website in which I have two different buttons. By using

  • 0

I am creating a website in which I have two different buttons.

By using jQuery, I want to hide and show two elements. Both elements are the text. e.g by click on buttonA, textA should show and if textB was visible, it should hide. similarly by click on buttonB, textB should show and if textA was visible, it should hide. Initially both the text should be hidden but loaded on their positions.

Both the texts have same positioning on the layout. i have defined a class (.content is its name) which maintains all the styling for the text. Now the issue I am facing is that I have two div both with the class but I am unable to give two different ids to the texts.

.content {
  visibility:hidden;
  border-style: none;
  display: block;
  position: fixed;
  text-align: centre;
  z-index: 1;
  margin-top: 40%;
  margin-left: 25%;
  margin-right: 25%;
  background-color: transparent;
  font-size:2.5em;
}

The problem is here how to assign some unique ids also to both texts

<div class="content">TextA goes here<br></div>
<div class="content">TextB goes here<br></div>

so when I use jquery

$("#ButtonA").click(function(){
  $("#TextA").show();$("#TextB").hide();
});

$("#ButtonB").click(function(){
  $("#TextB").show();$("#TextA").hide();
});

Though it might be lame question but I couldnt figure it out myself so had to ask.

  • 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-16T05:19:13+00:00Added an answer on June 16, 2026 at 5:19 am

    Can you explain why you can’t use different ids for the elements?

    <div class="content" id="TextA">TextA goes here<br></div>
    <div class="content" id="TextB">TextB goes here<br></div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a newbie in jscript and jquery. I am creating a website, which
I have a website which I have been working on creating very rapidly, and
I have a website which is behaving oddly in terms of creating new sessions.
So I am creating a website that I want to have an admin directory
I am new to ASP.NET. I am creating a website in which i have
I'm creating a php website in which I have a document.php that basically takes
I'm creating a website which is white, so I dont have any background assigned.
I'm creating a website in which I have an array of sub forms to
I am new to Asp.net I am creating website which have DropDown list and
I am creating a website which can display a bunch of playlists I have

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.