I have an input-field in my form which sometimes gets displayed and sometimes not. When the input-field doesn´t get displayed and the form is about to get sent the script throws an error:
Cannot read property 'value' of undefined
I tried to catch that with this code:
if (typeof document.forms["add-new-job"].addjob_companyselect.value !== 'undefined') {
// do something
}
But the same error comes again on this line. How can I skip an undefined field?