CMS Joomla component Forms Balbooa
How to make in the field Name Validation that it is possible to write only letters.
I have written such a script but it does not work.
jQuery(document).ready(function($) {
function applyValidation() {
// Search for input by field ID (in your case, 1)
const input = $('input[name="1"]');
if (input.length) {
input.on('input', function(e) {
e.target.value = e.target.value.replace(/[^a-zA-Zа-яА-ЯёЁ\s]/g, '');
});
}
}
// Running
applyValidation() immediately after loading the DOM;
// If the field appears dynamically, use MutationObserver
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
mutation.addedNodes.forEach(function(node) {
if(node.nodeType === 1) {
if($(node).find('input[name="1"]').length) {
applyValidation();
}
}
I've tried other options, but it still doesn't work.
Could you please help me?
The form itself is available at the link
https://schooldance.webtm.ru/forma
Replies are visible only to logged in members with an active subscription.