I have created a new webpart page, in this page inserted content editor and my list web part e.g. employee list with latest SharePoint Online version. Then, in the content editor I have entered below script:
<script src="https://abc.sharepoint.com/sites/cds/SiteAssets/jquery-3.1.1.min.js"></script>
<script type="text/javascript>
var j = jQuery.noConflict();
function PreSaveItem()
{
debugger;
if ("function"==typeof(PreSaveAction))
{
return PreSaveAction();
}
return true;
}
function PreSaveAction() {
debugger;
var txtTitle = j(":input[title='Title']").val();
alert(txtTitle);
if(txtTitle == ''){
alert("Please enter a title");
return false;
}
else{
return true;
}
}
</script>
However, both the functions PreSaveAction and PreSaveItem are not firing...