I need to create java script which will show me the alert like Versioning is enabled or not for that document library when user open any document library.

Please let me know how I can achieve this by using java script any reference

1 Answer 1


Add content editor webpart on list view web page and add below code snippet

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script><script>
$(document).ready(function () {
    $listName = ctx.ListTitle;
    $siteurl = _spPageContextInfo.webAbsoluteUrl;
    var url = $siteurl+"/_api/web/lists/getbytitle('"+$listName+"')?$select=EnableVersioning"
    getData(url).done(function (data) {
            alert("Versioning is enalbe");
            alert("Versioning is not enabled")



getData = function (url) { return $.getJSON(url); };

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.