![]() |
Detecting anchor tag on hyperlinks
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. This code is adding the anchor tag to hyperlinks with the anchor already in place... 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! |
str.indexOf("<a")
If the value is -1, the anchor tag is not there; if it is 0 or greater, it is. |
Code:
return this.each( function() {Code:
return this.each( function() { if(this.tagName.toLowerCase()=="a"){return; } |
| All times are GMT +1. The time now is 05:39 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.