jeudi 23 juillet 2020

json values via checkboxes

in FE I have two searches. One search is by text: If I type in the post code the correct output from json works fine. But I want to have a second search by checkboxes. There you should be able to find the right company by product.

But I am not good enough in Javascript to find out how it works. I've made a jsfiddle. Would be aweseome if you could help.

You can see my code below and in a better way in https://jsfiddle.net/kzayjn4m/

"productLines": ["Heimanwender", "SOHO", "Small Business" , "Medium Business", "Enterprise", "Öffentliche Hand", "Gesundheitswesen"],

document.getElementById('hero').addEventListener('onchange', function(e){
if(e.which == 13){
    searchStores();
}

});

function searchStores() {
var foundStores = [];
var zipCode = document.getElementById('zip-code-input').value; 
var place = document.getElementById('hero').checked;
 
 if (place) {
     stores.forEach(function (store, index) {
         var places = store.productLines;
        
            if (places == true) { 
            foundStores.push(store);
        
        }
    }
    )
}



Aucun commentaire:

Enregistrer un commentaire