var link = $('<a></a>').attr(attribute_name,value); $(target_element).append(link);
This will work. On Sep 24, 2: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.