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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:27:41+00:00 2026-05-30T18:27:41+00:00

I have searched before posting but none of the posts are that relevant (saying

  • 0

I have searched before posting but none of the posts are that relevant (saying that i am new to Jquery).

My problem is when i click the “add friend” button it wont fire upon a single click but it needs a double click.

These are the relevant sections of code:

Setting the div:

$fField = <div style="display:inline; border:#CCC 1px solid; padding:5px; background-color:#E4E4E4; color#999; font-size:11px;">
  <a href="#" onclick="return false" onmousedown="javascript:friendArea(\'addFriend\');">Add Friend</a>
  </div>;

Javascript:

function friendArea(x){
    //alert(x);
    if($('#'+x).is(":hidden")){
        $('#'+x).slideDown(200);
    } else {
        $('#'+x).hide();
    }
    $('.friendSlide').hide();
}

the message to display (the one which needs 2 clicks to be displayed)

<div class="friendSlide" id="addFriend">Are you sure?</div>

Any help would be much appreciated! Oh and I’m using the latest version of jQuery.

  • 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-30T18:27:43+00:00Added an answer on May 30, 2026 at 6:27 pm

    Hmm, well, it looks like you are showing and hiding your div at the same time:

    HTML:

    <div class="friendSlide" id="addFriend">Are you sure?</div>
    

    JS:

    function friendArea(x){
        //alert(x);
        if($('#'+x).is(":hidden")){
            $('#'+x).slideDown(200);
        } else {
            $('#'+x).hide();
        }
        $('.friendSlide').hide();
    }
    

    You call friendArea('addFriend'), which is supposed to slideDown your div, but at the end of the function you hide .friendSlide, of which your div is also a class. You basically hide it every time. This can’t be what you want.

    Comment out that line and it works: http://jsfiddle.net/Ggdhp/

    Of course, you might have had a different reason for that, but I think you are getting some divs and classes mixed up.

    Note:
    I would also suggest that you don’t use inline css or javascript. It always makes debug much more difficult, and you miss typos as you end up having to put everything on a single line and escape quotes. For instance, color#999; in your div style is missing a colon.

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

Sidebar

Related Questions

I've searched this question in Stack Overflow before posting it, but none of the
I quickly searched for this before posting, but could not find any similar posts.
I have searched through many times but have not seen this before. Probably really
I have searched up and down the internet for a jQuery widget that does
I have searched apple's documentation and other posts on Stack Overflow, but I'm still
I have searched for some similar questions before posting - however I have a
I am aware that this question has been asked before, but I have tried
I have searched for this before posting.. I have a page in my site
apologies if this has been asked before but I have searched the site... Anyway,
I have searched and searched for a solution to this problem, but it seems

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.