const selectElement document querySelector sel1 var partDiv document q

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const selectElement = document.querySelector('#sel1');
var partDiv = document.querySelector('#partial');
$(partDiv).empty();
selectElement.addEventListener('change', (event) => {
var selind = document.getElementById("sel1").options.selectedIndex;
var txt= document.getElementById("sel1").options[selectElement.selectedIndex].getAttribute('imagepath');
var val= document.getElementById("sel1").options[selind].value;
var elem = document.getElementsByClassName('partial');
event.preventDefault();
event.stopPropagation();
var $detailDiv = $('#partial'),
url = txt;
$.get(url, function(data) {
$detailDiv.replaceWith(data);
});
});