Re-Ordering Components on Chargify Hosted Signup Pages
Chargify offers hosted Public Signup Pages so that you don’t have to worry about handling credit card data when your customers sign up for your product or service. If you use Components as part of your pricing model, you may have noticed that they always appear in alphabetical order, and that there is no option to re-order them. If you need to display them in a different order, it’s not hard to do with a little Custom JavaScript (JQuery).
Here is part of a signup page listing some types of fruit that you can add to your monthly order:
Examining the source of the page, we find that the components are wrapped in <div>
elements:
UPDATE: The div
for each component now has a unique id
!
Because of this, you can easily select them:
And having done that, you can re-order them however you like:
This will reverse the order of the second and third components, and then move the fourth one to the top. Now the components are listed in a different order:
It can also be done without the intermediate var assignment:
As you might expect, in addition to insertBefore
there is also insertAfter
, and you can search the JQuery docs to find out what else is available.
Feel free to fork and experiment with this JSFiddle: http://jsfiddle.net/wsmoak/1maef2ow/6/
Setup
Note that you will need to replace the numbers with the ids of your own components, which can be found on the Setup tab in your Chargify account.
Once you have the code working the way you want it to, return to Chargify and edit your Public Signup Page. Paste the code into the “Custom JavaScript” area (you may need to un-check the ‘Use default’ checkbox first) and then save your changes.
Be sure to thoroughly test your signup pages before launching them!