I am trying to add translate code <?= __('This field is required') ?>
in the Magento file using JavaScript but it is not working plz help me.
if(response.length == 0) {
document.getElementById('test').innerHTML = '<span style="color:red;">'<?php __('This field is required') ?>'</span>';
return false;
}
Are any quotes missing or not calling PHP correctly inside JavaScript quotes?