document.getElementById('FIELD ID HERE').disabled = true;
Could you let me know a bit more about your use-case for disabling a field? The above code will make it impossible to type in or change a field. If you’re looking to make sure a certain value in a form field stays intact a hidden field might be a more suitable option for you.
Hi Rob, thanks for the reply but I found a very simple workaround solution, which was just to place a see-through box over the field that I didn’t want to be editable. But thanks for this, this type of code is what I had in mind when I first posted here!