Inserting current href with javascript -


i'm editing wordpress plugin need track outbound clicks google analytics' event tracking javascript code. challenge is, can edit 1 php file produces multiple links. in code below need replace part "this.getattribute('href')" href of link. how can done? have tried this.getattribute('href') code doesn't execute.

<a href="http://lifeplace.com.au/" onclick="trackoutboundlink(this, 'outbound links', this.getattribute('href')); return false;" title=""><img class="soliloquy-item-image" src="http://www.96five.com/wp-content/uploads/2013/03/image.jpg" alt="" title="lifeplace"></a> 

you set href dynamically anytime, value:

var anchor=document.getelementsbytagname("a")[0]; // sake of example anchor.href="www.google.de"; 

http://jsfiddle.net/lp5dc/


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -