$("#catSelectionStepForm").on('click', 'input[type=submit]', function() { $("input[type=submit]", $(this).parents("form")).removeAttr("clicked"); $(this).attr("clicked", "true"); }); $(document).ready(function () { $(document).on('change', 'select[name="cat1"], select[name="cat2"], select[name="cat3"], select[name="cat4"], select[name="cat5"], ' + 'select[name="cat6"], select[name="cat7"], select[name="cat8"], select[name="cat9"], select[name="cat10"]', function () { let divId = $(this).find('option:selected').data('value'); let catSelectId = $(this).attr('id').substring(3); filter.hideCats(Number(catSelectId) + 1); filter.getCats("#cat" + (Number(catSelectId) + 1), divId); $('#cat' + catSelectId + 'input').val(divId); }); var filter = {}; filter.getCats = (catId, divId) => { $.ajax({ type: 'get', url: '/class/getcats/'+ divId, success: function (response) { if(response['title'] != undefined){ response['success'] ? $('.post-icon > svg:last-of-type').hide() : $('.post-icon > svg:first-of-type').hide(); let btn = ''; if (response['link']) { const res = response['link'] if (Array.isArray(res)) { btn = ''; res.forEach(function (link) { btn += ` ` }) } else { btn = ""+response['continueBtn']+""; } } let content; if (response['msg']) { content = `
${response['title']}
${response['msg']}