![]() |
Detect if URL has anchor tag attached
Hey guys,
I'm currently using the following piece of script to add an anchor tag to URL's when they are fed into a page dynamically Code:
jQuery.fn.mailto = function () {I'm looking for some help in modifying this code to detect that if a URL already has anchor tag then leave it alone, but if it doesn't then add it on so it becomes clickable. I think this should be quite simple with the use of an if statement but I can't get my head around it. Any help is really appreciated! |
thisURL = document.URL;
if(thisURL.indexOf("#") != -1){ // hash tag detected in URL do stuff } |
The easiest way to test whether that part of the URL already has a value or simply to change it regardless of what value it had before is using location.hash
|
| All times are GMT +1. The time now is 10:49 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.