New item Archives : Binary Bits https://blog.binarybits.net/tag/new-item/ Bits & Pieces - A blog by Kannan Balasubramanian Mon, 17 Jul 2017 11:07:45 +0000 en-GB hourly 1 https://wordpress.org/?v=6.5.2 Change new item text in SharePoint https://blog.binarybits.net/change-new-item-text-sharepoint/ https://blog.binarybits.net/change-new-item-text-sharepoint/#respond Mon, 17 Jul 2017 10:52:31 +0000 https://blog.binarybits.net/?p=916 The following script changes the “new item” link button in SharePoint view form to whatever we desire. Add either of the script to content editor web part. Plain JavaScript version: (This code assumes that there is only one “new item” text in the entire page.) <script> document.addEventListener("DOMContentLoaded", function () { ExecuteOrDelayUntilScriptLoaded(function () { var ReRenderListView_old […]

The post Change new item text in SharePoint appeared first on Binary Bits.

]]>
The following script changes the “new item” link button in SharePoint view form to whatever we desire.

Add either of the script to content editor web part.

Plain JavaScript version: (This code assumes that there is only one “new item” text in the entire page.)

<script>
    document.addEventListener("DOMContentLoaded",
        function () {
            ExecuteOrDelayUntilScriptLoaded(function () {
                var ReRenderListView_old = ReRenderListView
                ReRenderListView = function (b, l, e) {
                    ReRenderListView_old(b, l, e)
                    changeText()
                }
            }, "inplview.js")
            changeText()
        }
    );

    function changeText() {
        var element = document.querySelector('#idHomePageNewItem span:nth-child(2)')
        element ? (element.innerHTML = "Add item") : null
    }

</script>

jQuery version: (This code can replace any number of “new item” text)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>

<script>
    $(document).ready(function () {

        var spans = document.getElementsByTagName("span");
        for (var i = 0; i < spans.length; i++) {
            if (spans[i].innerHTML == "new item") {
                spans[i].innerHTML = "add item";
                break;
            }
        }

    });

</script>

Source: sharepoint.stackexchange.com

The post Change new item text in SharePoint appeared first on Binary Bits.

]]>
https://blog.binarybits.net/change-new-item-text-sharepoint/feed/ 0