I don’t think this should be marked as resolved; I can’t find a way to stop WordPress from doing this. And adding a space before the #, while it does prevent the rest of the URL from being added, is not an option because it too breaks the jQuery I’m trying to appease.