Thursday, August 16, 2012

Replace all the Special Characters in SharePoint


function CorrectStringAsSPData(strValue)
{
    //Replace & symbol
    var givenString = strValue.replace(/&/g, "&");
    //Replace < symbol
    givenString = givenString.replace(/</g, "&lt;");
    //Replace > symbol
    givenString = givenString.replace(/>/g, "&gt;");
    //alert(givenString)
    return givenString;
}



No comments:

Post a Comment