body
либо весь скрипт оберните в document.addEventListener("DOMContentLoaded", function() { ... });
<!DOCTYPE html>
<html>
<head>
<title></title>
<script language="JavaScript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
</head>
<body>
<input onkeyup="check2()" id="input1" type="text">
<input onkeyup="check2()" id="input2" type="text">
<button disabled id="button">wefwf</button>
<script>
const input1 = document.querySelector('#input1');
const input2 = document.querySelector('#input2');
const button = document.querySelector('#button');
function check2() {
if (input1.value != '' && input2.value != '') {
button.disabled = false;
} else {
button.disabled = true;
}
}
</script>
</body>
</html>
<input type="text" placeholder="text">
<button>add</button>
<ul id="list"></ul>
let inp = document.querySelector("input");
let btn = document.querySelector("button");
let ulList = document.querySelector('#list');
btn.onclick = function() {
if (!inp.value) {
alert("Invalid input");
return false;
}
let li = document.createElement("li");
li.innerHTML = inp.value;
ulList.appendChild(li);
inp.value = "";
}
constructor(h, w, id = '') {
pattern="[\+][0-9]{9,12}"