I have a container called div that contains dynamically generated content (paragraphs) through javascript. The problem is that paragraphs are not shown on the div after they go outside the container. To solve this problem, I tried overflow, but just added x, y scrollbars.
What I'm trying to do is increase the height of the container after adding each paragraph added, that is, when a paragraph is added to a container with a height of 20 pixels, the container increases the height to another 40 pixels for the next paragraph.
HTML
<div class="container"></div> <a href="#" id="add">Add content</a>
CSS
.container { width: 120px; height: 20px; display: inline-block; margin-left: auto; margin-right: auto;
Javascript
$(function () { $('#add').on('click', function () { $('<p>Text</p>').appendTo('#container'); }); });
Any suggestions? Thanks!
source share