Embed Snippet on Your Site
MemberPress: Modify the Order of the Registration and the Account Form Fields
Each field in the registration and account form is a separate element. Thus, the order of these elements can be rearranged. This example code will move the "Country" and "City" before (above) the default "Address" field.
This code works with both default and custom fields on both registration and account forms and uses field slugs to identify fields and set the order. Each field requires a separate JavaScript variable (var) like this:
var country = $('.mepr_mepr-address-country');
These variables are used to set relations that will determine the order modification. Thus, the following code line moves the variable country related to the .mepr_mepr-address-country field above the field related to the address variable in parentheses:
country.insertBefore(address);
Modifying the variable in parentheses will change the field used to determine the position that should be set for other fields.
Also, modifying the .insertBefore method with the .insertAfter method will position other fields below the field related to the variable in parentheses.
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
I tried this and it worked, except each of the fields I moved doubled. I have two of each of the fields that I moved around on the form… I only changed the names of the fields/vars. Any idea what is going on?