Aller au contenu
Voici le seul résultat
document.addEventListener('DOMContentLoaded', function () {
jQuery(function ($) {
const $dropdown = $('#size');
if ($dropdown.length) {
$dropdown.select2({
templateResult: formatOption,
templateSelection: formatOption,
width: '100%'
});
function formatOption(option) {
if (!option.id) return option.text;
// Split option text into price and size
const match = option.text.match(/^(MAD\s*\d+)\s+(.*)$/);
if (!match) return option.text;
const price = match[1];
const size = match[2];
return $(`
${price}
${size}
`);
}
}
});
});