It is impossible to deduce as simple as we would like. Since the width of a character or character set will depend on the font size. And calculating the width of the text is hardly accurate.
So, the better you create your interface to be character-friendly, not width-wise.
var t = $("#div").text(); if(t.length > 50) { $("#div").text(t.substr(0,50)+"..."); }
source share