
/*
function clearMultiSelectInput(elementId) {
    const inputElement = document.querySelector("#Multi");
    if (inputElement) {
        inputElement.value = ""; // Clear the input value
    }
}
*/

// JavaScript function to restrict input
/*function restrictInput(event) {
    const allowedCharacters = "ab<>0123456789&";
    const key = String.fromCharCode(event.which);

    // Check if the key pressed is allowed
    if (!allowedCharacters.includes(key)) {
        event.preventDefault(); // Prevent the default action (input)
    }
}*/

window.validateTextBox = function (elementId) {
    var element = document.getElementById(elementId);
    element.addEventListener('keydown', function (e) {
        var allowedKeys = ['<', '>', '&', 'A', 'B', 'a', 'b'];
        if (!allowedKeys.includes(e.key) && !/[0-9]/.test(e.key)) {
            e.preventDefault();
        }
    }, false);
}




/* document.addEventListener('keydown', function (event) {
    // Check if the backspace key is pressed
    if (event.key === "Backspace") {
        // Call the function to prevent chip deletion based on chipText
        preventBackspaceOnSpecificChip(event);
    }
});



window.preventBackspaceOnSpecificChip = function (e) {
        var element = document.querySelector("#multiSelect");
        const wrapper = document.querySelector('.e-multi-select-wrapper');
        const chips = wrapper.querySelectorAll('.e-chips');

        chips.forEach(chip => {
            // Check if the chip has the 'remove-icon' class
            if (chip.classList.contains('remove-icon')) {
                e.preventDefault(); // Prevent deletion for these chips
            }
        });
};
*/

/*
    window.preventBackspaceOnSpecificChip = function (multiSelectId, chipText) {
        var element = document.querySelector("#multiSelect");

        // Add keydown listener on the MultiSelect element
        //element.addEventListener('keydown', function (e) {
        //if (e.key === "Backspace" || e.key === "Delete") {
        // Select the wrapper and find all chips inside it
        const wrapper = document.querySelector('.e-multi-select-wrapper');
        const chips = wrapper.querySelectorAll('.e-chips');

        chips.forEach(chip => {
            // Check if the chip has the 'remove-icon' class
            if (chip.classList.contains('remove-icon')) {
                e.preventDefault(); // Prevent deletion for these chips

                // e.stopPropagation();
            }
        });
        //}
        // });
    };*/
