Код: Выделить всё
const form = document.getElementById('form');
form.style.visibility = 'hidden';
function comment() {
const postLink = document.getElementById('postLink');
postLink.style.visibility = 'hidden';
if (form.style.visibility === 'hidden') {
form.style.visibility = 'visible';
} else {
form.style.visibility = 'hidden';
}
}
document.getElementById('button').addEventListener('click', function createPost() {
userInput();
});
function userInput() {
const textarea = document.getElementById('textarea').value;
if (textarea.length > 0) {
const cards = document.getElementById('cards');
const div = document.createElement('div');
cards.appendChild(div);
div.textContent = textarea;
}
}< /code>
.cards {
display: grid;
grid-template-columns: repeat(1, minmax(100px, 1fr));
gap: 40px;
justify-content: center;
}
.cards>div {
border-top-style: solid;
border-width: 5px 1px 0px 0px;
box-shadow: 5px 5px 20px #e0dfdf;
justify-self: center;
padding: 10px;
}< /code>
Type anything you want here and it will keep expanding.
[url=#]post[/url]
post
Подробнее здесь: https://stackoverflow.com/questions/797 ... submit-but