input - класс s-input . dropdown - класс dropdown. box - класс s-box
<div class="s-box">
<input type="text" id="input" autocomplete="off" class="s-input">
<input type="text" id="????" autocomplete="off" class="????">
<input type="submit" class="s-btn" value="Найти">
<ul class="dropdown" id="dropdown"></ul>
</div>
function box_listener(box){
const input = box.querySelector('.s-input');
const dropdown = box.querySelector('.dropdown');
if (input.value === '') dropdown.style.display = 'none';
const fetch_data = _ => {
$.post("files/auto_complet.php", { s: input.value }, (data, status) => {
if (data != "not found") {
dropdown.style.display = 'block';
dropdown.innerHTML = data;
box.querySelectorAll('.dropdown li').forEach(item => {
item.onclick = () => e.target.value = item.innerText;
});
}
});
}
input.oninput = fetch_data;
input.onclick = fetch_data;
}
document.querySelectorAll('.s-box').forEach(box => {
box_listener(box);
});
document.body.onclick = e => {
document.querySelectorAll('.dropdown').forEach(el => el.style.display = 'none');
}
nftcontract.methods.mint("1").send({from:account}).then(result => {
console.log("Information about transaction", result)
return;
}).catch(console.error);
if(JSON.stringify(x.responseText).types) { console.log('types here') }
function addPerson() {
personData.push({
name: document.getElementById('input_name').value,
age: document.getElementById('input_age').value
});
}
window.addEventListener('keydown', function(e) {
console.log(e.target.tagName)
if(e.keyCode == 32 && e.target === document.body) {
alert('k')
e.preventDefault();
}
});
function clear_key(obj, k) {
if(obj && k) {
Object.keys(obj).forEach(key => {
obj[key][k] = undefined;
});
return;
}
throw 'Object and key is required';
}
function clear_key(obj, k) {
if(obj && k) return Object.keys(obj).forEach(key => obj[key][k] = undefined);
throw 'Object and key is required';
}
if(!res.body || res.body && !res.body.length) {
// "API JavaScript"
}
const interval = setInterval(() => {
fetch('search.php', {
method: 'POST',
body: formData
})
.then(res => res.json())
.then(search => fetch('status.php', {
method: 'POST',
body: JSON.stringify(search)
})
)
.then(res => res.json())
.then(status => {
if(status === 200) clearInterval(interval)
console.log(status);
})
}, 300);
parseInt(atob(_0x5fd69b)[_0x00dd('0x2')](/\D/g, '')
_0x00dd('0x2')
let a = btoa(12345);
console.log(parseInt(atob(a)[0].replace('2', '')))
.test(str) => .test(el)
function pigIt(str){
const splitted = str.split(' ');
return splitted.map(el => {
console.log(el)
if(el.length === 1 && !new RegExp(/^[a-zA-Zа-яА-Я0-9]+$/).test(el)) return el;
const es = el.split('');
es[es.length] = es[0];
es.splice(0, 1);
return es.join('') + 'ay';
}).join(' ');
}