document.body.insertAdjacentHTML('afterEnd', '<div id="bigdiv" style="width: 30%; padding: 15px; position: absolute; top: 10%; z-index: 100; left: 35%; background-color: rgb(51, 53, 65); border-radius: 0.625rem; box-shadow: rgb(255, 101, 47) 0px 0px 5px 0px; border: 1px solid rgb(255, 101, 47);">Content</div>');
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<button id="btn">CLICK ME!</button>
<script type="text/javascript">
"use strict";
window.addEventListener("storage", event => {
if (event.key !== "goReload") return;
window.location.reload();
});
document.getElementById("btn").addEventListener("click", () => {
localStorage.setItem("goReload", localStorage.getItem("goReload") + "1");
});
</script>
</body>
</html>
(function() {
let addButtonElement = document.getElementById("add-task-btn");
addButtonElement.addEventListener("click", TaskModule.doTask.bind(TaskModule), true);
})();
document.querySelector(".exit").addEventListener("click", (e) => {
e.target.parentElement.style.display = "none";
});
const openPopupForm = (event) => {
let target, keyPress;
if (event) {
target = event.target;
keyPress = event.key;
event.preventDefault();
}
if (keyPress === "Enter" || !target) {
document.querySelector(".block").style.display = 'block';
}
};
document.addEventListener("keydown", openPopupForm);
openPopupForm(); // Вот вызываем функцию
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
.newClass {
display: flex;
}
</style>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.js"></script>
</head>
<body>
<button id="btn">VIEW</button>
<div class="newClass">
<div>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.</div>
<div>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.</div>
<div>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.</div>
<div>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.</div>
</div>
<script type="text/javascript">
"use strict";
$(".newClass").slideToggle(0);
$("#btn").on("click", function() {
$(".newClass").slideToggle();
});
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.js"></script>
</head>
<body>
<button id="btn"></button>
<script type="text/javascript">
"use strict";
let result;
$("#btn").on("click", function() {
console.log(result);
});
$.ajax({
url: 'https://jsonplaceholder.typicode.com/posts?userId=3',
success: function(res) {
result = res;
}
});
</script>
</body>
</html>