I have found the way to do this. I am sharing the answer to my question in case someone needs to do this:
- Create a folder called
mage
in your custom template with the following path:
/Sample/CustomTemplate/web/mage
- Place a copy of the file
validation.js
in this new mage folder. You can find a copy of the original validation.js
in the following path:
/Magento Folder/lib/web/validation.js
In my case, I wanted to move the .mage-error
outside of the .field
element, so I replace the following code:
fieldWrapper = element.closest('.addon');
with
fieldWrapper = element.closest('.field');