How to uncheck add as a new version to existing files in SharePoint Online

In this SharePoint customization tutorial, we will discuss, how to uncheck add as a new version to existing files in SharePoint Online or in SharePoint 2013/2016.

Here to uncheck add as a new version to existing files, we will use a piece of jQuery code in SharePoint.

uncheck add as a new version to existing files in SharePoint Online

In SharePoint Online or in SharePoint 2013/2016/2016, we can use the upload button to upload a document to a document library. And in the upload button you can see there will be a checkbox “Add as a new version to existing files” presented like below.

If the option is checked (Default), then when a user uploads a file with the same name which is presented in the document library already, then it will add the file with a different version.

uncheck add as a new version to existing files in sharepoint online
uncheck add as a new version to existing files in sharepoint online

One of my client requirement was to uncheck the “Add as a new version to existing files” checkbox by default.

For this, I have added a small piece of jQuery code into the SharePoint site. The code I have to add inside the master page because when I added the code inside a script editor web part, it did not work.

So make sure the code you have to add inside the master page before </head> tag.

<script type="text/javascript" 
 src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        if(window.location.pathname.indexOf("/_layouts/15/Upload") != -1) {
            $("input[type='checkbox']").attr('checked',false);
        }
    });
</script>

Once you add the code inside master page, your code should looks like below:

uncheck add as a new version to existing files sharepoint 2013
uncheck add as a new version to existing files sharepoint 2013

Then Save the SharePoint master page, and try to upload the document, you can see the checkbox will be unchecked by default like a blow:

uncheck add as a new version to existing files sharepoint
uncheck add as a new version to existing files sharepoint

You may like following SharePoint customization tutorials:

Hope this SharePoint helps to uncheck add as a new version to existing files in SharePoint online or in SharePoint 2013/2016.

>