This is great, thanks so much Sanford!
I was attempting to get this to work on a form that utilized visibility rules and just had to make a slight modification. Instead of using MktoForms2.whenReady, I used MktoForms2.whenRendered.
That will work -- but actually, the code should be tweaked somewhat if it's called from whenRendered, because otherwise you're constantly changing the DOM (not that you would necessarily notice, but it's inefficient). In whenRendered the order should be checked before reordering.
Thank you Sanford, very helpful!
Hi Sanford Whiteman, I was trying to have a look at your script by typing this "//codepen.io/figureone/pen/85e4921f8206e9bb73ac1829c6b0d05f.js" into the search bar and it gave a "file not found" error.
I'm wondering if that's on purpose or the file is simply not available anymore
This was for two reasons:
1 I'm trying to learn some javascript by reading other people's scripts here and there
2 If I were to use this reordering script, I wouldn't trust it to be hosted externally, because I wouldn't have control over it and it might cease working without me noticing
You don't use protocol-relative // URLs in the Location bar.
Enter just the hostname, or hard-code http: or https:.
By all means, self-host the JS files. Just include the copyright (it's MIT).
Mr Whiteman, I believe some face palming is in order...
I am learning so many different things in this forum
Thank you so much for taking the time to enlighten me (us)
In fairness, some browsers do let you paste the // URL, treating it as plain http:.
But this isn't universal because "relative" has to be relative to something. (Technically, a // URL could be an FTP or some other URI, doesn't have to be a web address.)
You mean you can browse inside your computer with chrome for instance?
See, I just learned that the "U" in "URL" means universal
It's fascinating how ignorant we can be of how things we use daily and are completely reliant on, actually work.
I take all of this "magic" for granted when I browse the internet or check my instant messages
Reminds me of this quote from Clarke: "Any sufficiently advanced technology is indistinguishable from magic" and a book called "Hard to be a God" which I liked very much
"U" means "Uniform" though.
Oops, you are absolutely right
I guess I stopped reading attentively after "uni":
"Uni... probablyversal - Resource - Locator"