$('td[background^="../"]').each(function (i){ this.background=this.background.replace('oldway','newway'); alert(i) });