clicking link in javascript -


i have anchor tag on pages.

<a id='signout' href='//somelocation'>signout</a> 

and have javascript file available pages. there function called , attached 'click' , 'touch' , 'key press' handler trying click link. like

document.addeventlistener('click' function(e){    var signoff = document.getelementbyid('signout');    location = signoff.href;   } 

this should click anchor tag whenever there click event not working.

some syntax corrections got working me:

document.addeventlistener('click', function(e) {    var signoff = document.getelementbyid('signout');    location = signoff.href; }); 

http://jsfiddle.net/jjgej/


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -