Search code examples
javascriptjqueryhtmltelerikkendo-menu

Href link is not rendering properly


I am using Kendo Menu bar to call javascript function on the click of Menu Item. But url of Kendo Menu is not rendering properly. Below is the code

function kendoMenu() {
    $('#menu').kendoMenu({
        //orientation: "vertical",
        dataSource: [
            {
                text: "Export",
                value: "newtransaction",
                items: [
                    {
                        text: " Managers",
                        value: "managers",
                        url: "javascript:ImportExport('OFD')"
                    },
                    {
                        text: " Terms",
                        value: "terms",
                        url: "javascript:doImportExport('OFI')"
                    },
                ]
            },
        ],
       // select: onKendoMenuselect
    });
}

But when i run the program, on the html side it is rendering as

<a class="k-link" href="javascript:ImportExport(" ofi')'=""> Terms</a>

But i want href to be rendered as:

<a class="k-link" href="javascript:ImportExport('ofi')"> Terms</a>

What should be the best approach? Thanks for the help in advance.


Solution

  • Escape quotes inside string using backslash (\)

    url: "javascript:ImportExport(\"OFD\")"
    
    url: "javascript:doImportExport(\"OFI\")"