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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:09:10+00:00 2026-05-22T19:09:10+00:00

I asked this question earlier today. After trying out suggestions from a few members,

  • 0

I asked this question earlier today. After trying out suggestions from a few members, I could not
accomplish what I want to do.

Here is a little more detail. I am trying to achieve a “Sign In/Sign Out” toggle functionality
when I click on a hyperlink. On my main page I have HTML like this:

<div id="signbtn">
        <a class="btnsignin" href="signin.php">Admin</a>
</div>

When I click the anchor link, I am showing a login form using .ajaxForm success: function. After I sign in,
the code inside this function changes the class to “btnsignout” and the title of the link to “Sign Out”.

I use the below code to toggle the anchor class to “btnsignin”, to log back in. The login form does not show up when I click on the anchor link.

$('#signbtn').click(function() { 
    $.each($(this).children('a'), function(){
        if($(this).hasClass('btnsignout')){
            $(this).attr('class', 'btnsignin');
        }
    })
});

Could someone point out to me where I am going wrong here? Thanks.

  • 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-22T19:09:11+00:00Added an answer on May 22, 2026 at 7:09 pm

    Not sure if this is the cause, but you should use addClass and removeClass to toggle classes. And you could shorten it to $(this).find(‘a’).removeClass(‘btnsignin’).addClass(‘btnsignout’)

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

Sidebar

Related Questions

I asked this question earlier today and from the console, it works as expected.
This relates to another question I asked earlier today. I built SVN 1.6.2 from
Earlier today I asked this question . After spending some time investigating this issue,
I asked this question a little earlier today but am not sure as to
Earlier today I asked this question which arose from A- My poor planning and
I asked another version of this question on the gamedev.SE site earlier today but
I asked this question earlier and am now trying to explore the idea of
I asked this goofy question earlier today and got good answers. I think what
earlier today I asked this question . So since moq creates it's own class
This is a follow-up to another question I asked earlier today. I am creating

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.