Hi all whats wrong with this script? getting Uncaught TypeError: Cannot set properties of null (setting ‘onchange’) Thanks
IsLegalPerson=document.getElementById('IsLegalPerson');
org=document.getElementById('org');
inp_org=document.getElementById('CustomerOrganization');
IsLegalPerson.onchange=function(){
if(this.value=='true')org.style.display='block';
else org.style.display='none';
};
document.body.init_checkout=initListeners;
document.body.updated_checkout=initListeners;
function initListeners(){
var btn = document.querySelector('#place_order');
if (!btn) return
btn.addEventListener('click', function(e){
if(IsLegalPerson.value=='false'&&inp_org.value==''){
e.preventDefault();
inp_org.value='tmp_value';
btn.click();
}
})
}