The jQuery attached is very close to working. It is returning (or appending) text twice.
I am iterating through an unordered list and appending a querystring paramter to the hrefs.
The ?InitialTabId=Ribbon.Document is being appending twice, like this:
http://www.google.com?InitialTabId=Ribbon.Document?InitialTabId=Ribbon.Document
Code:
$(document).ready(function() {
//foreach item in the quick launch, add a parameter to ensure the Ribbon is set to the Document tab
$('#zz18_V4QuickLaunchMenu ul li').each(function() {
$(this).find('a').attr('href', function (i, val) {
return val + '?InitialTabId=Ribbon.Document';
});
});
});
Does anyone have any ideas how to make the text only append once?
No need for
each().There should be no appending the string twice with this code. (FWIW, there should be no appending the string twice with your code, either.)