<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<input id="elem1" type="text" name="quantity" placeholder="количество">
<input id="butt" type="button" value="кнопка"><br>
<div id="str"></div>
<script>
let butt=document.getElementById('butt')
butt.onmousedown=()=>{
document.getElementById("str").innerHTML="Вы ввели"+document.getElementById('elem1').value;
}
</script>
</body>
</html>
<div id="popUp"
style="position: absolute;width: 100px;height: 100px;background: yellow;color: black;border-radius: 10px;border: solid 1px #000;text-align: center" hidden=true>
<span id="popUpText">это текс поп ап</span>
<button id="btPopUpClose" style="">закрыть</button>
</div>
<script>
let docUrl='http://localhost';///значение url при котором всплывает попап
let popUpMess='покаазываем ПОПАП'; // тест попапа
if (!document.URL.indexOf(docUrl)){
document.getElementById('popUp').hidden = false;
document.getElementById('popUpText').innerHTML=popUpMess;
let btPopupClose = document.getElementById('btPopUpClose');
btPopupClose.onmousedown = () => {
document.getElementById('popUp').hidden = true;
}
}
</script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<button id="idBtn">open</button>
<div id="idDiv" style="width: 200px;height: 200px;background: #00f" hidden="true">ТУТА мИнЮ</div>
<script>
let div=document.getElementById('idDiv');
let btn=document.getElementById('idBtn');
btn.onmousedown=()=>do1();
function do1() {
div.hidden=false;
btn.innerText='Close'
btn.onmousedown=()=>do2();
}
function do2() {
btn.onmousedown=()=>do1();
btn.innerText='Open';
div.hidden=true
}
</script>
</body>
</html>
<body>
<input id="inp" width="11em" style='border-bottom-color: black'>
<script>
let inp=document.getElementById('inp');
inp.oninput=()=>{
let rText='';
let s=inp.value.replace(/\s+/g, '');
s.split('').forEach((it,i)=>{
if (i%3===0){
rText+=' ';
}
rText+=it;
});
inp.value=rText;
}
</script>
</body>