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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -