Reputation: 5114
I need to append text user entered into a fixed width and height div. I set the div overflow:auto, but I only want to show vertical scrollbar, don't want to see the horizontal one. How to make the text wrap automatically to fix the width of div?
<script>
function Send(){
var text=$("[id$='Text1']").val();
$('#contentDIV').append("me: "+text+"<br />");
}
</script>
Upvotes: 1
Views: 2719
Reputation: 18761
The text will wrap unless a word is longer than your div
can content. In this case you just have word-break (CSS3).
Upvotes: 1
Reputation: 26554
div{
width:400px;
height:400px;
overflow-y:auto;
}
online demo: http://jsfiddle.net/3CQmP/
Upvotes: 4