add message for emojis not supported on this type

main
alexanderroese 2024-07-25 22:21:21 +02:00
parent ec27a08ebc
commit 158cbde63a
1 changed files with 15 additions and 3 deletions

View File

@ -567,7 +567,17 @@
}
}
function createInputLabelIfNotExists(inputID) {
if (!document.querySelector(`label[for="${inputID}-label"] span`)) {
const span = document.createElement("span");
span.style.marginLeft = `10px`
document.querySelector(`label[for="${inputID}-label"]`).appendChild(span)
}
}
setTimeout(() => {
createInputLabelIfNotExists(inputID)
showErrorMessageIfEmojiNotSupported(document.querySelector(`#${inputID}`).value, inputID)
/*
const event = new Event('input', {
@ -577,12 +587,14 @@
document.querySelector(`#${inputID}`).dispatchEvent(event); */
document.querySelector(`#${inputID}`).addEventListener('input', (e)=>{
if (!document.querySelector(`label[for="${inputID}-label"] span`)) {
document.querySelector(`#${inputID}`).addEventListener('input', (e) => {
createInputLabelIfNotExists(inputID)
/*if (!document.querySelector(`label[for="${inputID}-label"] span`)) {
const span = document.createElement("span");
span.style.marginLeft = `10px`
document.querySelector(`label[for="${inputID}-label"]`).appendChild(span)
}
} */
document.querySelector(`label[for="${inputID}-label"] span`).style.display = `inline`
document.querySelector(`label[for="${inputID}-label"] span`).style.color = null;
document.querySelector(`label[for="${inputID}-label"] span`).textContent = e.target.value.length + ' von ' + maxLength + ' Zeichen verwendet';