var flexibleContentField = (function (w, d, $, undefined) { 'use strict'; var s = { selectors: { theRepeater: '.form-statut', theSelect: '.field-selection__select' } }, els = {}, init = function () { // console.log("hello !"); // $(this).on('change', checkTarget); // define elements els.theRepeater = $(s.selectors.theRepeater); els.theSelect = $(s.selectors.theSelect); // no elements if (!els.theRepeater.length) { return; } els.theSelect.each(function() { let c = $(this).attr("checked"); if(c){ // console.log(this); hideShow(this); } }); els.theSelect.each(function() { $(this).on('mouseup', function(){ hideShow(this); }); }); }, checkTarget = function(event) { // console.log($(this).attr("value")); }, hideShow = function (elem) { els.theRepeater.each(function() { // $(this).parents().eq(2).hide(); }); let v = $(elem).attr("value"); // $("."+v).parents().eq(2).show(); } return { init: init }; }(window, window.document, window.jQuery)); // // // theCall - on window loaded (function (w, d, undefined) { "use strict"; // .parentElement.nodeName; var raf = requestAnimationFrame || mozRequestAnimationFrame || webkitRequestAnimationFrame || msRequestAnimationFrame, init = function () { w.flexibleContentField.init(); }; // when all is loaded raf ? raf(function () { w.setTimeout(init, 500); }) : w.addEventListener('load', init); }(window, window.document));