jQuery in SharePoint 2013 Script Editor Web Part not Executing when Minimal Download Strategy (MDS) Enabled
A word of warning. If you have the Minimal Download Strategy (MDS) feature activated in your SharePoint 2013 site, you may have challenges executing jQuery from a Script Editor Web Part or in page code placement.
jQuery that is on page load seems to function, but if you try to execute from a button or click event, it will not execute and leave you with an undefined error tied to the function you attempted to execute. This may be due to the call to execute not being cached, while on page load jQuery events are. If this affects you, there are 2 1/2 options as follows:
1) Disable MDS and lose the benefits of caching
2) Edit the master page to include the jQuery references as listed in this post: http://www.gsoft.com/en/blog/sharepoint-2013-developing-with-the-new-mds-feature
2 1/2) Hope that Microsoft addresses this limitation with a hotfix or Cumulative Update
UPDATE: Previously, wrapping code in $(document).ready(function () { }); was not working, but appears to be functional now when using jQuery 2x. Please test!