document.querySelectorAll('#select option').forEach(n =>
if (n.selected == true) {
n.textContent += n.value + '!';
} else {
n.textContent += n.value + '-';
}
)
const getVal = option =>
option.value;
// или
// option.getAttribute('value');
// option.attributes.value.value;
const addText = (option, text) =>
option.text += text;
// или
// option.textContent = option.textContent.concat(text);
// option.innerText = `${option.innerText}${text}`;
// option.append(text);
// option.insertAdjacentText('beforeend', text);
// option.appendChild(document.createTextNode(text));
// option.insertBefore(new Text(text), null);
const addValToText = option => addText(option, getVal(option));
Array.prototype.forEach.call(select, addValToText);
// или
select.querySelectorAll('option').forEach(addValToText);
// или
for (const n of select) {
addValToText(n);
}
// или
for (let i = 0; i < select.options.length; i++) {
addValToText(select.options.item(i));
}
// или
(function add(i, n = select.children[i]) {
if (n) {
addValToText(n);
add(i + 1);
}
})(0);
// или
const add = n => n && (addValToText(n), add(n.nextElementSibling));
add(select.firstElementChild);
$size: 36px;
border-radius: calc(#{($size/2) / $size});
$size: 36px;
$result: ($size/2) / $size;
border-radius: calc(#{$result});
$size: 36px;
border-radius: calc((#{$size}/2) / #{$size});
$size: 36px;
border-radius: (($size/2) / $size);
/*Даны два инпута и кнопка. По нажатию на кнопку запишите в первый инпут значение второго инпута, а во второй инпут - значение первого. Ваш код должен работать универсально, для любых значений инпутов.*/
var elem1 = document.querySelector('#elem1');
var elem2 = document.querySelector('#elem2');
var button = document.querySelector('button');
var buff
button.addEventListener('click', function() {
buff = elem1.value;
elem1.value = elem2.value
elem2.value = buff;
})
flex-grow: 1;
$(document).ready(function() {
var stock__clients = $(".owl-carousel");
stock__clients.owlCarousel({
dots: true,
nav: false,
loop: true,
smartSpeed: 2000,
animateOut: 'fadeOut',
navText: '',
items: 1,
});
});
var button = document.querySelectorAll('button');
button.addEventListener('click', function() { ... } )