How can I replace part of a string which is wider than 50 px with "..."?
<p>I am looking for a function which replaces part of a string which is wider than 50px with <code>"..."</code>. I want to implement it in Javascript/jQuery.</p>

<p>Example:</p>

<ul>
<li>Say I have a variable <code>var="Theta Saving Non-Qualified Plan";</code> 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 <code>"..."</code>.</li>
</ul>

<p>Any idea guys?</p>
