$ta = mysqli_connect($link,"SELECT * FROM name_table");
<p>
<b>Text</b>
<input type="text" id="text">
<b>Color</b>
<input type="text" id="color">
</p>
<button id="create">create</button>
<button id="update">update</button>
<button id="del">delete</button>
<ul id="items"></ul>
.active {
border: 2px solid black;
}
const
[ items, text, color, create, update, del ] =
[ 'items', 'text', 'color', 'create', 'update', 'del' ]
.map(n => document.getElementById(n));
create.addEventListener('click', () => {
items.insertAdjacentHTML('beforeend', `<li style="color: ${color.value}">${text.value}</li>`);
updateForm('', '');
});
update.addEventListener('click', () => ifActive(a => {
a.innerText = text.value;
a.style.color = color.value;
}));
del.addEventListener('click', () => ifActive(a => a.remove()));
items.addEventListener('click', e => {
const item = e.target.closest('li');
if (item) {
ifActive(a => item !== a && a.classList.remove('active'));
item.classList.toggle('active');
ifActive(a => updateForm(a.innerText, a.style.color));
}
});
function ifActive(f) {
const active = items.querySelector('.active');
active && f(active);
}
function updateForm(textVal, colorVal) {
text.value = textVal;
color.value = colorVal;
}
<keep-alive include="имя-компонента-страницы-с-табами">
<router-view></router-view>
</keep-alive>
$pattern = '/Сумма задания: (\d+\.\d+)/';
usort($arr, function($a, $b) use($pattern) {
preg_match($pattern, $a, $ma);
preg_match($pattern, $b, $mb);
return $mb[1] - $ma[1];
});
const citiesListNames = citiesList.map( item => { return item.name } )
приложение зависает от такого колличества данных
focusOnSelect: true
.$slick.on('click', '.slick-slide', function() {
$slick.slick('slickGoTo', this.dataset.slickIndex);
});
nums1 = nums1.slice(0, m).concat(nums2).sort((a, b) => a - b);
nums1.splice(0, nums1.length, ...[ ...nums1.slice(0, m), ...nums2 ].sort((a, b) => a - b));
// или
nums1.slice(0, m).concat(nums2).sort((a, b) => a - b).forEach((n, i) => nums1[i] = n);
<a :href="category.link">
router-link
, или уберите ссылки.v-if
) содержимое этого объекта.props: [ 'start', 'end', 'title', 'delay' ],
data: () => ({
val: null,
}),
created() {
this.val = this.start;
const interval = setInterval(() => {
if (++this.val >= this.end) {
clearInterval(interval);
}
}, this.delay);
},
<div>
<h3>{{ title }}</h3>
<div>{{ val }}</div>
</div>
data: () => ({
counters: [
{ start: -20, end: 69, title: 'hello, world!!', delay: 40 },
{ start: 0, end: 187, title: 'fuck the world', delay: 45 },
{ start: 400, end: 666, title: 'fuck everything', delay: 20 },
],
}),
<v-counter
v-for="n in counters"
v-bind="n"
/>