There are three problems with the following line:
$('.ms-vb2 .ms-lastCell).eachl(function() {
- You didn't put a closing
' after lastCell.
- The space in your selector means you will be selecting any
.ms-lastCell elements that are descendants of .ms-vb2 elements. If you remove the space and say '.ms-vb2.ms-lastCell' it will find elements with both classes.
- You misspelled
.each (with an l on the end).
There are a couple of problems with the contents of your .each() callback. The first line is OK, it gets the contents of the cell. But then:
var replaceValue = lastColumn.Append("Changed Content");
I'm not sure what you're trying to do here, but lastColumn is a string, and strings don't have an Append() method. If you want to add to the existing value you can say:
var replaceValue = lastColumn + "Changed Content";
If you just want to replace it say:
var replaceValue = "Changed Content";
If you intend to throw away the old value and just provide a new value you can skip all of that and say:
$(this).html("Changed Content");
Finally, you don't really need to use .each() when only one cell is going to match your selector (or when you want to update all matching elements to the same value), so you can just do this:
$('.ms-vb2.ms-lastCell').html("Changed Content");
Or if you want to add to the existing content you can use the syntax of the .html() method that takes a callback function:
$('.ms-vb2.ms-lastCell').html(function(i, oldHtml) {
return oldHtml + "Changed Content";
});
Where jQuery calls your callback function passing in the old value so you can process it however you see fit and then the value you return becomes the new html content of the element. If more than one element matches your selector your callback will be called for each in turn.