i am trying to add text to a div sectionj using jquery but the text goes outside my desired div.. my html looks something like:
<!--CONTENT AREA-->
<div id="content">
<div id="content_inner">
<h2 id='titulo'>BUSCAR:</h2>
KEYWORDS:
<input type='text' id='paramsQuery'>
<input type='submit' id='botonBuscar' value='buscar'>
<div id='results'></div>
</div>
</div>
my js function looks like this:
$(document).ready(function() {
$("#botonBuscar").click(function() {
var params = $("#paramsQuery").val();
$("#column3_inner").append(params);
});
});
any suggestions to make the text stay on the desired width?
You’re adding the results to an element not in the code provided. Perhaps you meant to put it in
#resultsinstead?Demo: http://jsbin.com/icapuh/edit#javascript,html
If your text is overflowing your box, you can have a few options there. You could break the lines:
Or you could cause scrolling:
Or setup
text-overflowto reveal ellipsis: