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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:34:21+00:00 2026-05-18T10:34:21+00:00

i need to know if this is possible and how…. I have a series

  • 0

i need to know if this is possible and how….

I have a series of linkk

< a href=”#” id=”hello” > HELLO < /a >

< a href=”#” id=”welcome” > welcome < /a >

< a href=”#” id=”start” > start < /a >

< a href=”#” id=”finish” > finish < /a >

what i want to do is as i click on the link I wish to add the id value to an array(words). so if i click all the 4 links my array should have hello, welcome,start,finish. Consequently if that is not possible can you concatenate them to a single variable on each click without destroying the previous data in the variable..words=(hello|welcome|start|finish).

any help is appreciated.

thanks
andy

  • 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-18T10:34:21+00:00Added an answer on May 18, 2026 at 10:34 am

    so if your js file looks like this (and jquery has been included on the page)

    var ClickedLinks = [];
    $(function () {
        $('a').click(function () {
            var id = $(this).attr('id');
            if ($.inArray(id, ClickedLinks) == -1) {
                ClickedLinks.push(id);
            }
        });
    });
    

    This will check the array and NOT add it again.

    EDIT: Fixed $.inArray returning a position, rather than a boolean (as I incorrectly assumed)

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

Sidebar

Related Questions

I'm new to PHP so I don't know whether this is possible. I need
Go ahead and let me know if this is not possible: I need to
I need to know when I click on an element if this element has
I have this JQuery code working however I need to know whether how to
I dont know if this possible But I have an ajax function in my
I need to know when a users's profile was created. Is this possible through
i dont know if this is possible, but i will explain what i want
My application need to download several web-pages simultaneously and i know this is possible
i need to know if this effect is possible to achive/mimic in Sencha Touch
i need to know this.. in the asp.net membership provider, it is possible to

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.