var divs = document.querySelectorAll(".thumbnails-container > div");
var cont = document.getElementById("container-1-1");
var cont2 = document.getElementById("container-2-1");
for (var i = 0 ; i < divs.length; i++) {
divs[i].addEventListener('click', function(event) {
var target = event.target;
cont.style.backgroundImage = target.style.backgroundImage;
cont2.style.backgroundImage = target.dataset.clastering;
});
}
body.no-scroll {
overflow-y: hidden;
}
.overlay {
display: none;
}
.overlay.active {
display: block;
}
$('.menu-toggle').click(toggleMobileMenu);
$(document).keyup(function(e){
if (e.keyCode == 27 && $('#Mobile-menu').hasClass('open')) {
toggleMobileMenu();
}
});
function toggleMobileMenu() {
$('body').toggleClass('no-scroll');
$('.overlay').toggleClass('active');
$('#Mobile-menu').toggleClass('open');
}
<select id="test">
<option value="tes1t">1</option>
<option value="test2" selected="selected">2</option>
<option value="test3">3</option>
</select>
var sel = document.getElementById("test");
var val = sel.options[sel.selectedIndex].text;
var sel = document.getElementById("test");
var val = sel.options[sel.selectedIndex].value;
var select = $('#test option:selected');
var val = select.val();
$.ajax({
url: 'index.php',
type: 'POST',
data: val,
success: function(data){
//полученный ответ
},
error: function(err){
// ошибка
}
})