I'm trying to replace a string (Completed) with another string (C) that resides in a tablecell in some HTML being returned from a jquery POST. The POST is working correctly and I'm able to find my string, but setting it to the new string doesn't seem to do anything (no errors, but the original string is rendered in my page). Below is my code. Any ideas? Note the commented-out line is what I was originally trying to use to do the find/replace, and then used the indexOf when I couldn't get it working:
$.post(myURL, "", function(data){
$(data).find("#ReportOutput tr td").each(function(index) {
//$(":contains('Completed')", this).css('backgroundColor', '#006600').css('color','white').html("C");
// the above is not working, not sure why. Below is workaround
if ($(this).html().indexOf("Completed") > 0) {
alert("found it. " + $(this).html());
$(this).html("C");
}
});
$(data).find("#ReportOutput").appendTo('#divdetails');
});
divdetails is just a div where I am displaying the HTML. No errors when running this, and the alert happens showing it found my string, but when the html loads into the div it shows the "Completed" string.
Can anyone point out what I'm doing wrong?
Thanks