<div class="form-group customer-field" data-property-id-row="1">1</div>
<div class="form-group customer-field" data-property-id-row="2">2</div>
<div class="form-group customer-field" data-property-id-row="3">3</div>
<div class="form-group customer-field" data-property-id-row="4">4</div>
<div class="form-group customer-field" data-property-id-row="15">15</div>
<div class="form-group customer-field" data-property-id-row="10">10</div>
<div class="form-group customer-field" data-property-id-row="13">13</div>
<div class="form-group customer-field" data-property-id-row="18">18</div>
.form-group {
border: solid 1px #6c757d;
padding: 10px;
margin-bottom: 20px;
}
$.each(customerFields, function(index, field) {
let idRow = $(field).attr('data-property-id-row');
if (idRow == "10" || idRow == "13" || idRow == "15") {
$(field).hide();
}
});
const ids = [ 10, 13, 15 ];
.$(ids.map(n => `[data-property-id-row="${n}"]`).join(', ')).hide();
const elems = document.querySelectorAll(ids.map(n => `[data-property-id-row="${n}"]`));
for (let i = 0; i < elems.length; i++) {
elems[i].style.display = 'none';
}
document.querySelectorAll('.form-group').forEach(function(n) {
n.hidden = this.has(Number(n.getAttribute('data-property-id-row')));
}, new Set(ids));
.hidden {
display: none;
}
for (const n of document.getElementsByClassName('form-group')) {
n.classList.toggle('hidden', ids.includes(+n.dataset.propertyIdRow));
}
let propIdsToHideBlocks = ['10', '13', '15'],
customerFields = $('.form-group').toArray();
$.each(customerFields, function(index, field) {
var idRow = $(field).attr('data-property-id-row');
if (~propIdsToHideBlocks.indexOf(idRow)) {
$(field).hide();
}
});
if (propIdsToHideBlocks.includes(idRow)) {
$(field).hide();
}