$('a') means selecting all the 'a' tag element and set their attribute. if you want to create an new element and add it to your page, try
var newAtag = $(document.createElement("a")).attr(...); $("select the parent element").append(newAtag); On Thu, Sep 24, 2009 at 5:06 PM, Coxy <stephenbung...@yahoo.de> wrote: > > How do I create a new tag with jquery? > > I tried something like this: > > link = $('a').attr({ > class : 'logoLink', > target : '_blank', > href : 'http://www.someurl.com/' > }); > > And then appended it to another image, but this added every link that > already existed on the page. -- Best Regards, David Shen http://twitter.com/davidshen84/ http://meme.yahoo.com/davidshen84/