$('#plus').click(function() {
let rowID = 12;
$("table tbody tr:first").clone().find("input").each(function(index) {
if(index === 0) {
$(this).attr('name', 'id['+rowID+']').val(rowID);
} else {
$(this).attr('name', 'id['+rowID+']').val('');
}
}).end().appendTo("table");
});
#search_table VS #search_card
input[name^=name] VS [data-item-name="name"]
val() VS text()
const addFilter = (listenSelector, findSelector, methodName) => {
$(listenSelector).keyup(function search() {
const search = this;
const searchValue = $(search).val().toLowerCase();
$("#tabname tbody tr")
.find(findSelector)
.each(function () {
const currentValue = $(this)[methodName]().toLowerCase();
$(this).closest("tr").toggle(currentValue.includes(searchValue));
});
});
};
addFilter('#search_table', 'input[name^=name]', 'val');
addFilter('#search_card', '[data-item-name="name"]', 'text');
$('.js_open_footer_menu').on('click',function () {
var windowWidth = $(window).width();
if (windowWidth > '768') {
$(this).next('ul').slideToggle();
$(this).toggleClass('active');
} else {
$('.js_open_footer_menu').next('ul').slideDown();
}
});
<?php
$datapost = array(
array(
'header' => 'город Москва',
'category_id' => '1',
),
array(
'header' => 'село Огонёво',
'category_id' => '2',
),
array(
'header' => 'село Быстрино',
'category_id' => '2',
),
array(
'header' => 'посёлок Восточный',
'category_id' => '7',
),
);
$query = mysqli_query($connect, "SELECT `id` FROM `category` ");
$rows = mysqli_fetch_all($query, MYSQLI_ASSOC);
$arIDs = [];
foreach($rows as $row) {
$arIDs[$row['id']] = $row['id'];
}
$arResults = [];
foreach($datapost as $data) {
if(array_key_exists($data['category_id'], $arIDs))
$arResults[$data['category_id']][] = $data;
}
print_r($arResults);
А нельзя ли как-то упростить?
<svg width="200" height="300">
<mask id="my-mask">
<g stroke="gray" stroke-width="12" fill="white">
<circle cx="33%" cy="30%" r="20%" />
<circle cx="52%" cy="62%" r="32%" />
</g>
</mask>
</svg>
<!-- 1 -->
<svg width="200" height="300">
<image href="https://picsum.photos/id/1/200/300" width="200" height="300" mask="url(#my-mask)"/>
</svg>
<!-- 2 -->
<svg width="200" height="300">
<image href="https://picsum.photos/id/2/200/300" width="200" height="300" mask="url(#my-mask)"/>
</svg>
<!-- ...100500 -->
<svg width="200" height="300">
<image href="https://picsum.photos/id/3/200/300" width="200" height="300" mask="url(#my-mask)"/>
</svg>
.project-timeline
.step
.number 1
.content Lorem ipsum dolor sit amet.
.step
.number 2
.content Lorem ipsum dolor sit amet.
....