jquery loop and compare values
- by lgt
Is it possible to use jqueries each loop in this form to dissolve hyperlinks?
$(document).ready(function() {
var toExclude =['http://www.google.com', 'http://example'];
$.each(toExclude, function(key, value) {
$("a[href='+value+']").replaceWith(function(){
var url=value;
var matches = url.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
var domain = matches && matches[1];
return domain;
});
});
});