Javascript array of href's

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2010-05-05T16:19:18Z Indexed on 2010/05/05 16:38 UTC
Read the original article Hit count: 412

Filed under:
|
|

Hi,

I am trying to create an array with different href's to then attach to 5 separate elements.

This is my code:

var link = new Array('link1', 'link2', 'link3', 'link4', 'link5');

                    $(document.createElement("li"))
                    .attr('class',options.numericId + (i+1))
                    .html('<a rel='+ i +' href=\"page.php# + 'link'\">'+ '</a>')
                    .appendTo($("."+ options.numericId))

As you can see I am trying to append these items from the array to the end of my page so each link will take the user to a different section of the page. But i have not been able to do this. Is there a way to to create elements with different links?

I am new to javascript so I am sorry if this doesn't make a whole lot of sense. If anyone is confused by what i am asking here I can try to clarify if I get some feedback.

Any solutions would be greatly appreciated.

Thanks,

jason

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery