Parsing the Sharepoint Site Actions menu with jQuery

On recent Sharepoint (WSS3) sites I use jQuery extensively.  One of the things I often do is to remove the default Site Actions menu and draw those same links at the bottom of each page in the site.  I had found a way to successfully parse the Site Actions menu using some trickery:

$(‘#siteactions ie\\:menuitem’).each(function(){

(Note: my Site Actions Menu lives in a div called #siteactions in my master page)

This seemed to work well until I wanted to take advantage of the latest SPServices release which is now compatible with the latest jQuery.  I suspect (though I haven’t done extensive testing to be sure) is that some of the same issues with the new jQuery that were incompatible with the earlier release of SPServices were causing my issues.  After a bit of head-scratching I decided to sidestep the issue alltogether.  I couldn’t quite find a way to select the ie:menuitem nodes and step through them with an ‘each’ so instead I opted to simply use:

$(‘#siteactions menu’).children().each(function(){

I suppose this may have been obvious to some but for some reason I was determined to get the selector right.  If you know how to select elements with namespaces across-browsers in jQuery 1.7 I would be very interested to hear.



Leave a comment