function runAfterElementExists(jquery_selector, callback) {var checker = window.setInterval(function() {if ($(jquery_selector).length) {clearInterval(checker);callback();}}, 200);} var ArtNr = 'NEW-36960'; $('input[name="variationid"]').val('NEW-36960'); $(".ItemQuestionForm form > input[data-mail='subject']").val("Artikel-Nummer: " + ArtNr); $('.ItemQuestionForm input[name="Artikelnr."]').attr('disabled', 'disabled').val(ArtNr); runAfterElementExists('.variation-select', function() { function getSelection() { if ($('.variation-select:first-child>div>span').length > 0) { $('.currentSelection').removeClass('d-none'); var csName_1 = $('.variation-select:first-child>div>span').html(); var csSelection_1 = $('.variation-select>div>b').html(); $('.currentSelection_1').html(csName_1 + ' ' + csSelection_1); }; if ($('.variation-select:first-child>b').length > 0) { $('.currentSelection').removeClass('d-none'); var csName_1 = $('.variation-select:first-child>span').html(); var csSelection_1 = $('.variation-select:last-child>b').text(); $('.currentSelection_1').html(csName_1 + ' ' + csSelection_1); }; if ($('.variation-select').length > 1) { if ($('.variation-select:last-child>div>span').length > 0) { var csName_2 = $('.variation-select:last-child>div>span').html(); var csSelection_2 = $('.variation-select:last-child>div>b').html(); $('.currentSelection_2').html(''+ csName_2 + ' ' + csSelection_2); }; if ($('.variation-select:last-child>b').length > 0) { var csName_2 = $('.variation-select:last-child>span').html(); var csSelection_2 = $('.variation-select:last-child>b').text(); $('.currentSelection_2').html(''+ csName_2 + ' ' + csSelection_2); }; }; }; getSelection(); $(".v-s-box ").click(function() {getSelection();}); $(".variation-select select").change(function() {getSelection();}); });