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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:41:47+00:00 2026-06-14T14:41:47+00:00

I have three paragraphs which are made to look like three seperate buttons: <p

  • 0

I have three paragraphs which are made to look like three seperate buttons:

<p id="showCloud" class="newRefreshThree" name="tabbed"><span class="ico"></span><a href="">{i18n key="evadmin.title.cloud"}</a></p>

{if $enableCapacityReport=="1"}

<p id="showStats" name="tabbed"><span class="ico"></span><a href="" >{i18n key="evadmin.stats.showstats"}</a></p>

{/if}

<p id="showInfrastructure"  name="tabbed" class="newRefreshFour"><span class="ico"></span><a href="">{i18n key="evadmin.title.infrastructure"}</a></p>

All of them share the same name, name = tabbed

Each of these paragraphs/buttons send a user to a seperate tab and I would like to highlight the button of whichever tab is selected, while making sure all the other types are then un-highlighted.

Just now I wrote what I thought was the first part of the JQuery I need:

$('p[name=tabbed]').click(function(){
        $(this).css('background-color','red');
        });

but obviously this doesn’t deselect the other p’s, and I didn’t know the most efficient/nicest way of doing it..

Also I would like to have an initial button/p highlighted when the page orignally loads so that it starts off highlighted for that tab.

Could anyone recommend to me what event/method I can use to do everything I just stated, or even give an example? Regards

  • 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-14T14:41:48+00:00Added an answer on June 14, 2026 at 2:41 pm

    If you’re not going to be dynamically adding <p> elements to the page, then you can cache the selector, use that to manipulate all of the paragraphs, then finally apply your style to the element that was clicked on.

    var $p = $('p[name="tabbed"]');
    $p.click(function(e) {
        $p.css('background-color', '');
        $(this).css('background-color', 'red');
    });
    

    Or, use a CSS class declaration, and use the removeClass() and addClass() functions to add/remove that class as appropriate:

    CSS
    .red {
    background-color: red;
    }

    jQuery:

    var $p = $('p[name="tabbed"]');
    $p.click(function(e) {
        $p.removeClass('red');
        $(this).addClass('red');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 80-90 classes which are all a type of calculation. But each class
I have created a notes field designed to hold multiple paragraphs of text which
I have text in db which looks like this: <p> blah blah blah </p>
I have two paragraphs in a buffer which has only simple text in it:
I have a long document in LaTex, which contains paragraphs. The paragraphs contain sentences
I have some code which displays three images and a respective div under each
I have a stylesheet which indents paragraphs by 20px, but I do not want
I have a series of paragraphs. Each one ends with a illustration which clarifies
I have a string which is a sequence of html paragraphs, I want to
Have three classes User, Group and Field. Many to many relationship on User /

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.