I know of the jQuery $.trim() function, but what I need is a way to trim whitespace from the END of a string only, and NOT the beginning too.
So
str =\
For some browsers you can use: str = str.trimRight(); or str = str.trimEnd();
str = str.trimRight();
str = str.trimEnd();
If you want total browser coverage, use regex.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimEnd