I am looking for a function which replaces part of a string which is wider than 50px with "..."
. I want to implement it in Javascript/jQuery.
Example:
- Say I have a variable
var="Theta Saving Non-Qualified Plan";
I want to put a restriction on the length of the string (based on pixel width). If the length of string is more that 50px, then the part of the string which is from the 51st pixel to theend of string will be replaced with"..."
.
Any idea guys?