there is this script:
$(function() { var $categoryWrap = $('#categoryWrap'); $categoryWrap.on('change', 'select', function () { var $this = $(this), category_id = this.value; $('#categoryIdInput').val(category_id); $this.nextAll().remove(); if(category_id == '0') { $('#typeCategory').remove(); $('#fieldsAdvert').remove(); return false; } $.ajax({ url: 'index.php?route=ajax/SubCategoryList', data: { id_cat: category_id }, type: 'POST', success: function(data) { $('#typeCategory').remove(); $('#fieldsAdvert').remove(); if (data != '') { var $newSelect = $('<select name="subCategory[]" class="subCategory" data-id="' + category_id + '"/>'); $newSelect.append('<option value="0">- <?=$text_select?> -</option>') $.map(data, function(v) { $newSelect.append('<option value="' + v.id + '">' + v.title + '</option>') }); $categoryWrap.append($newSelect); } } }); }); }); which works great, but, only after the site is fully loaded, how can I make the same script work the same way when the site is reloaded?
localstorage, Luke! - user207618