It works for me using the same code as you: $('mtext').addClass('red');
.
Perhaps you are not waiting until the markup has actually been loaded/added to the DOM before running the jQuery selector? That would prevent jQuery from finding any elements to add the class to.