Oh sorry, the section of JavaScript I added was from an email just to use as an example. I have used that same piece of Javascript, with all the appropriate amendments to the actual HTML I used.
Hi @POOLEYAWESOME, apart from the typos, you’d have to handle this in a change event listener – otherwise the check only runs once when the script gets evaluated, but doesn’t react to changes later on. Like
var textarea = document.getElementById('txt_address');
var select = document.getElementById('order_type');
select.addEventListener('change', function() {
if (this.value === 'pick-up') {
textarea.disabled = true;
} else {
textarea.disabled = false;
}
});
Okay awesome. thanks.
So just to make something clear, is what you wrote before all to be added into the JavaScript validation code? Should there any changes to any of the HTML at all?
Not sure what you mean with validation code… just put it somewhere at the end of the body, so that those DOM elements are available when the the script runs. The script works with the HTML you posted above – here’s a fiddle.