Your Problem is that you mistake selectors that work within the jQuery selector engine & selectors that are defined in the CSS spec.
When you write tr:last
you actually want tr:last-child
or .tableclass tr:last-of-type
etc.
Please go check this MDN page that explains the defined selectors & pseudo selectors, not all are supported by every browser, but most of them do work in modern browsers.