Wednesday, August 3, 2011

Disable New Menu Button Prompt in Sharepoint 2010

if you added any content types to library , when you click on "New" button automatically it prompts for to open first content type. you can disable that prompt by using below code.

_spBodyOnLoadFunctionNames.push("DisableNewMenuPrompt");
function DisableNewMenuPrompt() {
            var tableTag = document.getElementsByTagName("table");
            for (j = 0; j < tableTag.length; j++) {

                if (tableTag[j].id.match("NewMenu_t")) {

         var eleAttribute = tableTag[j].getElementsByTagName("tr")[0].getElementsByTagName("td")[0];
                   
                   eleAttribute.removeAttribute("onclick", "CoreInvoke");
                    eleAttribute.setAttribute("onclick", "javascript:return false;");
                }
            }
        }

No comments:

Post a Comment

Followers

Blog Archive