window.onload = function(){
var companyInput = document.getElementsByName('companyname')[0];
var nameInput = document.getElementsByName('name')[0];
var emailInput = document.getElementsByName('email')[0];
var phoneInput = document.getElementsByName('phone')[0];
companyInput.required = true;
nameInput.required = true;
emailInput.required = true;
phoneInput.required = true;
var form = companyInput.form; // Assuming all inputs are in the same form
var errorElement = document.createElement('p');
errorElement.id = 'error';
errorElement.style.color = 'red';
form.appendChild(errorElement);
form.addEventListener('submit', function(e) {
var nameParts = nameInput.value.trim().split(' ');
if (nameParts.length < 2) {
e.preventDefault();
document.getElementById('error').textContent = 'Full Name must be at least 2 words separated by space.';
} else {
document.getElementById('error').textContent = '';
}
});
var checkExist = setInterval(function() {
var tabText = document.querySelector('.tab-text');
if (tabText && tabText.textContent === 'Other') {
tabText.style.display = 'none';
clearInterval(checkExist); // Stop checking once the element is found
}
}, 100); // Check every 100ms
};