I have a webpart in my Sharepoint and the div ID for that is MSOZoneCell_WebPartWPQ4 due to some reasons I need to change it. Is there any way to change it? or how can I modify only a single webpart without using its div ID?

I was wondering if someone could help me! Thanks.

  • please could you be more specific? Feb 24, 2016 at 14:21

2 Answers 2


Screen capture of a web part

If you look at the screen capture above, you will see that the Web Part Title exists in a SPAN included in an H2 with the class ms-webpart-titleText. If you are using jQuery, you could do something like the code below to find the specific web part.

var webpart;
var webPartTitle = "Some Specific Web Part";
     if ($(this).text() == webPartTitle){
         webPart = $(this).closest("span").closest("[id^='MSOZoneCell_WebPart']");

Most of the time, there will only be one SPAN that contains the title but use the .each in case SharePoint decides to do something different. That should get you the specific web part and then you can change whatever you want.


If you are using SharePoint, you have to live within the limitations that SharePoint gives you. One of those is the inability to name the divs. If you rename a DIV, then SharePoint won't know what to do with them.

I do quite a bit of work on the client in SharePoint. If you can provide me with a use-case on why you feel you need to change the DIV name, I may be able to give you a suggestion that will solve your problem in a different way.

  • Thanks, the reason I need to change the webpart's div ID's is because I wanted to modify the background color for only one webpart and it worked nice, but when i want to add a webpart on another site it shows me the webpart with that background color. Example I changed the background for this webpart: MSOZoneCell_WebPartWPQ4. Now if I add a new webpart as I said and if that webpart has the same id with modified one, it shows me the webpart with modified background. Am I clear? Feb 24, 2016 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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