<!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>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<input id="inputPhone" value="+7(___)___-__-__" >
<script>
let inputPhone=document.getElementById("inputPhone");
inputPhone.oninput=()=>phoneMask(inputPhone)
function phoneMask(inputEl) {
let patStringArr = "+7(___)___-__-__".split('');
let arrPush = [3, 4, 5, 7, 8, 9, 11, 12, 14, 15]
let val = inputEl.value;
let arr = val.replace(/\D+/g, "").split('').splice(1);
let n;
let ni;
arr.forEach((s, i) => {
n = arrPush[i];
patStringArr[n] = s
ni = i
});
arr.length < 10 ? inputEl.style.color = 'red' : inputEl.style.color = 'green';
inputEl.value = patStringArr.join('');
n ? inputEl.setSelectionRange(n + 1, n + 1) : inputEl.setSelectionRange(17, 17)
}
</script>
</body>
</html>
let curEl=document.getElementsByClassName("mpIt mpId456")[0]
let newTag=document.createElement(newTageName)
curEl.appendChild(newTag)
<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>