how best to set text alignment in a table
- by ericslaw
Does anyone know of a jquery plugin or snippet that will auto-text-align cells in a table based on content?
Specifically, all table cells would be right justified unless there is a visible non-number related character in the cell, then it would be left justified. I'd like to use something like this regular expression to identify non-number related characters in a cell:
/[^0-9% +-()]/
Is there a real simple way to accomplish this?
I would think something like this:
$("td:contains('[^0-9% +-()]')").addClass("left");
would do the trick, but I don't think 'contains' can take a regular expression.