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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:22:17+00:00 2026-05-26T11:22:17+00:00

<div id=price> <a href=http://example.com/<?php echo $_GET[‘Path’];?>&sort=3a>Price Up</a> <a href=http://example.com/<?php echo $_GET[‘Path’];?>&sort=3d>Price Down</a> </div> <div

  • 0
<div id="price">
    <a href="http://example.com/<?php echo $_GET['Path'];?>&sort=3a">Price Up</a> 
    <a href="http://example.com/<?php echo $_GET['Path'];?>&sort=3d">Price Down</a>
</div>
<div id="name">
    <a href="http://example.com/<?php echo $_GET['Path'];?>&sort=2a">Name Up </a> 
    <a href="http://example.com/<?php echo $_GET['Path'];?>&sort=2d">Name Down </a>
</div>

When the user clicks Price Up, the Price Down should show and Price Up should be hidden and vice versa. Similarly for Name Up and Name Down.

Why this can’t work?

$("#price a,#name a").eq(1).hide(); 
  • 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-26T11:22:18+00:00Added an answer on May 26, 2026 at 11:22 am

    First off all, this doesn’t work:

    $("#price a,#name a").eq(1).hide();
    

    because '#price a, #name a' matches four elements then eq(1) selects the second of the four (eq uses zero based indexes) so only Price Down gets hidden. If you want to hide both Down links then you want the :eq selector:

    $('#price a:eq(1), #name a:eq(1)').hide();
    

    To toggle them you just need just a simple click handler on all the <a> elements:

    $('#price a, #name a').click(function() {
        $(this).hide().siblings().show();
        return false;
    });
    

    The siblings call is an easy way to get all elements at the same level as this without include this in the list. You’d need to alter that slightly if your <div>s contained something other than the <a> elements that you’re interested in.

    Demo: http://jsfiddle.net/ambiguous/xwB2b/


    Update For Comments: If you need to keep the links as links but also include some sort of show/hide toggling then you’ll need another control (or your users will hate you for trying to make one control do two things). Something like this:

    <div id="price">
        <button class="flipper">Flip</button>
        <a href="http://example.com/<?php echo $_GET['Path'];?>&sort=3a">Price Up</a> 
        <a href="http://example.com/<?php echo $_GET['Path'];?>&sort=3d">Price Down</a>
    </div>
    <div id="name">
        <button class="flipper">Flip</button>
        <a href="http://example.com/<?php echo $_GET['Path'];?>&sort=2a">Name Up </a> 
        <a href="http://example.com/<?php echo $_GET['Path'];?>&sort=2d">Name Down </a>
    </div>
    

    And this:

    $('#price a:eq(1), #name a:eq(1)').hide();
    $('.flipper').click(function() {
        $(this).siblings().toggle();
    });
    

    Demo: http://jsfiddle.net/ambiguous/CAAan/

    You could style the <button> any way you wanted.

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

Sidebar

Related Questions

I have the following HTML code: <div onclick=window.open('http://example.com') > <p>1234 Main St, New York,
struct Div { int i; int j; }; class A { public: A(); Div&
we've codeded this PHP-Script: function price($id) { $ergebnis = mysql_query(SELECT * FROM preiszuordnungen where
I have in my page many of this <div class=price> 15 Dollars <a class=showHide>Show
Why does this code: var jQueryString=div.data > div.item > div.quantity,div.article,div.price > :input; $(jQueryString).live(click, function(event)
div#thing { position: absolute; top: 0px; z-index: 2; margin: 0 auto; } <div id=thing>
Header div on top of the 3 columns Height of all columns must fill
$('div.box').html(hello) puts the word hello inside all my div's of class 'box'. They all
this div to cover up the viewport works perfect on IE 7, 8, FF,
the div on website below that have search at the bottom and it always

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.