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

  • Home
  • SEARCH
  • 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 7031329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:47:21+00:00 2026-05-28T00:47:21+00:00

Is it possible to toggle (switch) a rel attribute in the same way that

  • 0

Is it possible to toggle (switch) a rel attribute in the same way that classes can be toggled in jquery? http://api.jquery.com/toggleClass/

I am trying to create a button, that when clicked will change(toggle) the rel attribute of another button. Hope that makes sense.


Im pretty new to this and not sure if I have implemented you code right, but its not working. I might be just thinking about this thing wrong.

My idea is to use the animatedcollapse.js plugin (http://www.dynamicdrive.com/dynamici…edcollapse.htm) to animate the accordion. The accordion works the according to the “rel” attribute, either “rel=collapse[selected div]” or “rel=expand[selected div]”. To expand or collapse the accordion. The problem with the way it is set up is that when one div collapses another expands at the same time in the background.

http://dl.dropbox.com/u/14080718/Final/UITabs10.html

I am trying to make it so every time a new link is clicked the previous accordion is fully collapsed before it expands a new one. So every time a link is clicked the previous div is fully closed before it opens a new div.

I am thinking that a rel toggle between “rel=collapse[selected div]” and “rel=expand[selected div]” might solve this, but Im not sure. If you have any other ideas, I would love to hear them.

  • 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-28T00:47:22+00:00Added an answer on May 28, 2026 at 12:47 am

    I’ve just written a jQuery plugin.

    Usage: $("selector").toggleAttr("rel", "option1", "option2");

    (function($) {
        $.fn.toggleAttr = function(attribute, option1, option2) {
            return this.each(function() {
                var $this = $(this);
                if ($this.attr(attribute) != option1) {
                    $this.attr(attribute, option1);
                } else {
                    $this.attr(attribute, option2);
                }
            });
        }
    })(jQuery);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to create a toggle button in C# WinForms? I know that
I have built a slider that has two possible buttons: one to .toggle ,
Possible Duplicate: Use same div to toggle different parts of the page Hello I
In jQuery, I know that we can pass true or false value to the
Possible Duplicate: Loading multiple versions of the same class What is the best way
Hi I was wondering is it possible to align the toggle button on a
Possible Duplicate: .NET - What’s the best way to implement a catch all exceptions
Is it possible to toggle WiFi radio (On/Off) programmatically on android phones?
Possible Duplicate: How to enable or disable an anchor using jQuery? I've got an
Possible Duplicate: What's the proper way to minimize to tray a C# WinForms app?

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.