0

First of all I'm not sure if this counts as Joomla question or jQuery question. I have manipulated the joomla user jform and added an extra field jform_firstname to the list of fields. The current output is:

<div id="details">
    <div class="control-group">
        <div class="control-label">
            <label id="jform_username-lbl" for="jform_username" class="hasPopover required" title="" data-content="Enter the login name (Username) for the user." data-original-title="Login Name">
                Login Name<span class="star">&nbsp;*</span>
            </label>
        </div>
        <div class="controls">
            <input type="text" name="jform[username]" id="jform_username" value="james" class="required" size="30" required="required" aria-required="true">
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            <label id="jform_password-lbl" for="jform_password" class="hasPopover" title="" data-content="Enter the password for the user." data-original-title="Password">
                Password
            </label>
        </div>
        <div class="controls">
            <input type="password" name="jform[password]" id="jform_password" value="" autocomplete="off" class="validate-password" size="30" maxlength="99">                       
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            <label id="jform_email-lbl" for="jform_email" class="hasPopover required" title="" data-content="Enter an email address for the user." data-original-title="Email">
                Email<span class="star">&nbsp;*</span>
            </label>
        </div>
        <div class="controls">
            <input type="email" name="jform[email]" class="validate-email required" id="jform_email" value="admin@deanimaconsulting.com" size="30" required="required" aria-required="true">                        
        </div>
    </div>
    <div class="control-group">
        <div class="control-label">
            <label id="jform_firstname-lbl" for="jform_firstname" class="required">
                First name<span class="star">&nbsp;*</span>
            </label>
        </div>
        <div class="controls">
            <input type="text" name="jform[firstname]" id="jform_firstname" value="James" class="required" size="30" maxlength="255" required="required" aria-required="true" aria-invalid="false">
        </div>
    </div>
</div>

Is it possible with jQuery to move the whole control-group which contains jform_firstname to after the control-group for jform-username?

1

You could start with something like this

jQuery('.control-group').has('#jform_firstname')
    .insertAfter(jQuery('.control-group').has('#jform_username'));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.