fonte nettoyage des majuscules et des espaces dans l'id de la fonte

This commit is contained in:
Fred Tempez 2024-01-06 16:19:31 +01:00
parent 9fac118004
commit b6b5461241
1 changed files with 27 additions and 1 deletions

View File

@ -8,4 +8,30 @@
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
* @link http://zwiicms.fr/
*/
$("input[name=fontAddFontImported]").on("click",(function(){$("input[name=fontAddFontImported]").is(":checked")?$("input[name=fontAddFontFile]").prop("checked",!1):$("input[name=fontAddFontFile]").prop("checked",!0),$("#containerFontAddFile").hide(),$("#containerFontAddUrl").show()})),$("input[name=fontAddFontFile]").on("click",(function(){$("input[name=fontAddFontFile]").is(":checked")?$("input[name=fontAddFontImported]").prop("checked",!1):$("input[name=fontAddFontImported]").prop("checked",!0),$("#containerFontAddFile").show(),$("#containerFontAddUrl").hide()}));
$(document).ready(function () {
$("input[name=fontAddFontImported]").on("click", (function () {
$("input[name=fontAddFontImported]").is(":checked") ? $("input[name=fontAddFontFile]").prop("checked", !1) : $("input[name=fontAddFontFile]").prop("checked", !0), $("#containerFontAddFile").hide(), $("#containerFontAddUrl").show()
})), $("input[name=fontAddFontFile]").on("click", (function () {
$("input[name=fontAddFontFile]").is(":checked") ? $("input[name=fontAddFontImported]").prop("checked", !1) : $("input[name=fontAddFontImported]").prop("checked", !0), $("#containerFontAddFile").show(), $("#containerFontAddUrl").hide()
}));
// Exemple d'utilisation : appel de la fonction à chaque saisie dans le champ texte
$('#fontAddFontId').on('input', function () {
cleanString();
});
// Fonction pour supprimer les espaces et convertir en minuscules
function cleanString() {
var champTexte = $('#fontAddFontId');
var texte = champTexte.val();
texte = texte.replace(/\s/g, ''); // Supprimer les espaces
texte = texte.toLowerCase(); // Convertir en minuscules
champTexte.val(texte); // Mettre à jour le champ texte avec la nouvelle valeur
}
});