<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
</head>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur aliquam odit nemo, totam ex dignissimos. Qui in, inventore quae necessitatibus deserunt incidunt eos, nostrum blanditiis aperiam, aliquid voluptates delectus voluptate.</p>
<textarea name="txt" id="txt" cols="30" rows="10" style="display: inline-block;" ></textarea>
<div id="wrapper" style="width: 100px; height: 50px;">
<p>Lorem Ipsum is simsimpl 4i dummy text.</p>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="jquery.dotdotdot.js"></script>
<script>
$(document).ready(function(){
var hash = window.location.hash.substring(1)
if (hash.includes("withfocus")) {
$('#txt').focus();
}
$("#wrapper").dotdotdot({
/* The text to add as ellipsis. */
ellipsis : ' ...',
/* How to cut off the text/html: 'word'/'letter'/'children' */
wrap : 'word',
/* Wrap-option fallback to 'letter' for long words */
fallbackToLetter: true,
/* jQuery-selector for the element to keep and put after the ellipsis. */
after : null,
/* Whether to update the ellipsis: true/'window' */
watch : 50,
/* Optionally set a max-height, can be a number or function.
If null, the height will be measured. */
height : null,
/* Deviation for the height-option. */
tolerance : 0,
/* Callback function that is fired after the ellipsis is added,
receives two parameters: isTruncated(boolean), orgContent(string). */
callback : function( isTruncated, orgContent ) {},
lastCharacter : {
/* Remove these characters from the end of the truncated text. */
remove : [ ',', ';', '.', '!', '?' ],
/* Don't add an ellipsis if this array contains
the last character of the truncated text. */
noEllipsis : []
}
});
});
</script>
</body>
</html>