$("p.author").text(function() {
return $(this).text().replace(/(By|on)/g, '');
});
I found this on an earlier post which describes how to remove the word “By” from an element ‘p.author’
what I want to do is remove the a word from a title
something like this?
v = $('.datarow .location').attr('title').replace(/,/g,'');
$("span.name").attr('title').(v);
.attr()accepts a function as a second parameter, and gives us the old value of attr as it’s second argument.Here’s a demo: http://jsfiddle.net/83WLm/