# profile-builder/3.16.4/assets/js/script-front-end.js

User Profile Builder – Beautiful User Registration Forms, User Profiles &amp; User Role Editor, version 3.16.4. 25 lines.

- Page: https://pluginprobe.com/plugins/profile-builder/3.16.4/code/assets/js/script-front-end.js
- Raw: https://pluginprobe.com/plugins/profile-builder/3.16.4/raw/assets/js/script-front-end.js
- Modified: 2023-10-09T07:19:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/profile-builder/3.16.4/code/assets/js/script-front-end.js#L10-L20`.

```javascript
jQuery(document).ready(function(){

    if( jQuery("#wppb-register-user").length ) {
        jQuery('#wppb-register-user').on('submit', function (e) {

            //disable the submit button
            jQuery('.form-submit #register').attr('disabled', true);
            
        })
    }

    if( !window.wppb_disable_automatic_scrolling || window.wppb_disable_automatic_scrolling != 1 ){
        //scroll to top on success message
        if( jQuery("#wppb_form_general_message").length ){
            jQuery([document.documentElement, document.body]).animate({ scrollTop: jQuery("#wppb_form_general_message").offset().top }, 500);
        }
    }

    // Fix for Select2 search not focusing
    jQuery(document).on('select2:open', function() {
        let allSelect2Found = document.querySelectorAll('.select2-container--open .select2-search__field');
        allSelect2Found[allSelect2Found.length - 1].focus();
    })

})
```
