I have a field in my SharePoint list of type Hyperlink.

I want to format the list view so that all the items in it will display as bullet items.

I am using JSLink and below is my code. I want the DOM property URL.DESC. When I tried overrideCtx.CurrentItem.URL.desc it is not working.

However it is showing in the DOM.

enter image description here


(function () {
    var overrideCtx = {};
    overrideCtx.Templates = {};
     overrideCtx.Templates.Header = " " +
        "<hr><ul id='unorderedlist'>";

    overrideCtx.Templates.Item = CustomItem;
    overrideCtx.Templates.Footer = "</ul>";
    overrideCtx.BaseViewID = 1;
    overrideCtx.ListTemplateType = 103;
    overrideCtx.OnPreRender = preRenderHandler;
    overrideCtx.OnPostRender = postRenderHandler;

function CustomItem(overrideCtx) {
    var ret = "<li>"+ overrideCtx.CurrentItem.URL + "</li>";
    return ret;
// The preRenderHandler attends the OnPreRender event
function preRenderHandler(ctx) {

    // Override the default title with user input.
    //ctx.ListTitle = prompt("Type a title", ctx.ListTitle);

// The postRenderHandler attends the OnPostRender event
function postRenderHandler(ctx) {

    // You can manipulate the DOM in the postRender event
    var ulObj;
    var i, j;

    ulObj = document.getElementById("unorderedlist");

    // Reverse order the list.
    for (i = 1; i < ulObj.children.length; i++) {
        var x = ulObj.children[i];
        for (j = 1; j < ulObj.children.length; j++) {
            var y = ulObj.children[j];
                ulObj.insertBefore(y, x);

Try using:

var urlDesc = overrideCtx.CurrentItem['URL.desc'];

You can create a link like:

var urlLink = ctx.overrideCtx.URL;
var urlDesc = ctx.overrideCtx['URL.desc'];
var appendlnk = "<a href=" + urlLink + " target='_blank'>" + urlDesc + "</a>";  

Source: How to get the description of Hyperlink column of Custom List using JSLink


Sorry for the short answer, but this is how you get the URL's description:


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.