109
rated 0 times
[
110]
[
1]
/ answers: 1 / hits: 17554
/ 13 Years ago, wed, august 31, 2011, 12:00:00
I am looking to use jQuery contains to run through each image on a page and check if the src tag contains a certain http value. How would I run a check on the text in the src attribute with jQuery or javacript. I have the overview of what I am attempting below:
$('img').each(function(i){
var img = $(this),
imgSrc = img.attr('src'),
siteURL = http://url.com;
if(!imgSrc.contains(siteURL)){
imgSrc = siteURL + imgSrc;
}
});
I have a feeling regex may be the way to go just don't know how for sure.
More From » jquery