@billyboy: I'm not too sure what exactly it is you're trying to accomplish with your code. Do you have a link to the jsfiddle?
First off, doing something like this is unnecessary:
("[data-ref-id|='3010']").attr('href', function (idx, href) { return href; });
You're just setting the href attribute equal to its current value. Second, I'm a bit curious where this comes from:
var giant = "http://giantbomb.com";
I'm assuming that's just a test value for your code here, but where do you actually intend to pull that value from? Isn't that just going to be pulled from the href attribute itself? In which case, why not just do this:
$("[data-ref-id|='3045']").not("[href*='giantbomb.com']").attr('href', function (idx, href) {
return 'http://giantbomb.com' + href;
});
That should only select elements with that particular data-ref-id attribute which do not contain 'giantbomb.com' in their href attribute.
your awesome thanks ,this is what i wanted. im not a professional and javascript is not my strong side :D
Log in to comment