0

I'd like to add additional text next to "new item" in a sharepoint online library, but I don't want it to be part of the hyperlink to open the form. Here is a code snippet I have in a script editor I found to change "new item" to "new registration", but I also want just text next to it saying something like "to edit click (...) next to item"

<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 txt = " Hello"
    var element = document.querySelector('#idHomePageNewItem span:nth-child(2)')
    element ? (element.innerHTML = "New Registration" + txt.small()) : null
}

</script>

Is there an easy way to change my var txt to be just text without the hyperlink?

0

Add below:

var txt = " Hello"
var element = document.querySelector('#idHomePageNewItem span:nth-child(2)');
element ? (element.innerHTML = "New Registration") : null;
element.closest('a').after(txt)

enter image description here

  • Thanks, but this doesn't seem to work either. I don't get the " Hello" text after "New Registration". – psstdnt Feb 9 '18 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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