I have added the following code after the include for the JQuery file and the script tags in my master page. I put the script immediately before the end body tag of the master page.
$(document).ready(function () {
$(".ms - draggable ").each(function () {
alert("running");
var alt = $(this).attr('alt');
alt = "../"+ alt;
var a = $('<a/>').attr('href', alt);
$(this).wrap(a);
});
alert("docuemnt ready");
});
alert("running");
After I add the code. I save the page. Refresh my SharePoint site and I get the alerts only once. When I change pages or refresh the same page, I do not get the alerts again. What can I do on my master page to ensure this script executes after every page loads?
UPDATE: So this has morphed into this post as I realized they are both related to the same thing.
Top Naviation Menu is not loaded when script runs - SharePoint Foundation 2013 Oslo Master Page
