How to make SharePoint Attachment required

List item attachment in many cases needs to be required and at the same time the developer doesn’t want to edit the form using SharePoint designer. The trick is pretty easy, just edit the newForm.aspx to the list in browser and add content editor. Then, copy and paste the following script.

Note: you can change the message in the alert

<script type="text/javascript" language="javascript">
function PreSaveAction() {
if (document.getElementById('idAttachmentsRow').style.display=='none' )
     alert('Attachment is Mandatory! Please attach Documents.');
     return false ;
else {  return true;  }

Enjoy the required attachment with the alert.