var inputs= checkBoxes.getElementsByTagName('input');
function creatSelected(){
// console.log(inputs);
for(var i=0; i<inputs.length; i++){
if(inputs[i].checked ===true ){
var creatDiv = document.createElement('div');
creatDiv.innerHTML =inputs[i].parentNode.textContent;
creatDiv.classList.toggle('educationCreate');
multySelect.appendChild(creatDiv);
console.log(inputs[i].parentNode.textContent );
};
};
//console.log(inputs.length);
};
window.addEventListener("DOMContentLoaded", function() {
var clickHandler = "click";
if ("ontouchstart" in document.documentElement) clickHandler = "touchstart";
var multiselect = document.querySelector(".multiselect"),
select = multiselect.querySelector(".selectBox"),
checkboxes = multiselect.querySelector("#checkboxes");
select.addEventListener(clickHandler, function(event) {
checkboxes.classList.toggle("show");
checkboxes.classList.contains("show") ? window.addEventListener(clickHandler, hide) : window.removeEventListener(clickHandler,hide)
});
multiselect.addEventListener(clickHandler, function(event) {
event.stopPropagation();
creatSelected()
});
function hide() {
checkboxes.classList.remove("show");
window.removeEventListener(clickHandler, hide)
}
var inputs = checkboxes.getElementsByTagName("input"),
obj = {};
function creatSelected() {
for (var i = 0; i < inputs.length; i++) {
var div = obj[i];
if (inputs[i].checked) {
if (!div) {
obj[i] = div = document.createElement("div");
div.innerHTML = inputs[i].parentNode.textContent;
div.className = "educationCreate"
}
multiselect.appendChild(div)
} else if (div && div.parentNode) multiselect.removeChild(div)
}
}
creatSelected()
});