JavaScript
- 10 ответов
- 0 вопросов
3
Вклад в тег
const select = document.querySelector('select');
const ul = document.querySelector('.testClassUl');
select.addEventListener('change',()=>{
const selectedOptions = select.querySelectorAll('option:checked')
ul.innerHTML = "";
for(const option of selectedOptions){
var li = document.createElement("li");
li.classList.add('testClassLi');
li.innerText = option.innerText;
ul.appendChild(li);
}
});
async getAll(_sql) {
let conn;
try {
conn = await this.pool.getConnection();
return await conn.query(_sql);
} catch (err) {
throw Error(err);
} finally {
if (conn) {
await conn.release();
}
}
}
getAll("SELECT * FROM users").then(rows => {
if (rows.length) {
return rows[0];
} else {
return null;
}
})