Created
October 11, 2012 22:10
-
-
Save ccheney/3875832 to your computer and use it in GitHub Desktop.
jQuery: if href is blank remove the a tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
$("#buttons a").each(function() { | |
var href = $(this).attr("href"); | |
if(href == '') { | |
var imgSRC = $("img", this).attr("src"); | |
var imgSPL = imgSRC.split('.'); | |
var imgCOM = imgSPL[0] +'-g.'+ imgSPL[1]; | |
$("img", this).attr("src", imgCOM); | |
$(this).removeAttr('href'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment