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
so if your js file looks like this (and jquery has been included on the page)
This will check the array and NOT add it again.
EDIT: Fixed $.inArray returning a position, rather than a boolean (as I incorrectly assumed)