const fieldset = document.getElementById("#fieldset");
if (fieldset) {
document.getElementById("postButton").removeAttribute("disabled");
} else {
$("#form").on("submit", function (event) {
event.preventDefault();
const fieldset = document.getElementById("#fieldset");
if (fieldset) {
$.ajax({
url: "",
type: "POST",
contentType: "application/json",
data: form.toJson(),
})
}
});
функция_которая_добавляет_fieldset_ы() {
//...
document.getElementById("postButton").removeAttribute("disabled");
}
document.querySelector('.post-list').innerHTML += `
<div class="card" style="...">
<div class="card-body">
<h5 class="card-title">${post.title}</h5>
<p class="card-text">${post.body}</p>
<a href="#" class="card-link">Подробнее</a>
</div>
</div>`
posts.array.forEach
const menu = document.getElementById('menu');
const scroll = 128;
function toggleFixedMenu() {
menu.classList.toggle('fixed', window.pageYOffset > scroll);
menu.classList.toggle('default', window.pageYOffset <= scroll);
}
window.addEventListener('scroll', toggleFixedMenu);
toggleFixedMenu();
body.onclick = function(){
body.style.backgroundColor = 'black'
setTimeout(() => {
body.style.backgroundColor = ''; // Пустое значение установит то, что прописано изначально в css
}, 2000);
}
button.onclick = function(){
const saved = button.value; // Запомним, что было
button.value = 'НАЖИМАЙ!'
setTimeout(() => {
button.value = saved;
}, 2000);
}