*UPDATE *: Demo here: http://jsfiddle.net/cEepx/
I have this code that adds an ellipsis to the end of a text row before wrap:
(function (e) {
e.fn.ellipsis = function (t) {
var n = {
row: 1,
"char": "..."
};
return t = e.extend(n, t), this.each(function () {
var n = e(this),
r = n.text(),
i = n.height();
n.text("a");
var s = n.height(),
o = s * t.row;
if (i <= o) {
n.text(r);
return
}
var u = 1,
a = r.length;
while (u < a) {
var f = Math.ceil((u + a) / 2);
n.text(r.slice(0, f) + t["char"]), n.height() <= o ? u = f : a = f - 1
}
n.text(r.slice(0, u) + t["char"])
}), this
}
})(jQuery);
It is applied simply as:
$("div.mydiv").ellipsis();
How can I modify it to add a second function to remove the ellipsis from mydiv once they are added?
ellipsisin CSS property?