# profile-builder/3.9.6/assets/js/placeholder-labels.js

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

- Page: https://pluginprobe.com/plugins/profile-builder/3.9.6/code/assets/js/placeholder-labels.js
- Raw: https://pluginprobe.com/plugins/profile-builder/3.9.6/raw/assets/js/placeholder-labels.js
- Modified: 2021-01-06T14:15:40+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.9.6/code/assets/js/placeholder-labels.js#L10-L20`.

```javascript
/*
 * Function that adds placeholders to Login Forms and Widget fields
 *
 * @since v.2.1
 *
 */
jQuery( document ).ready( function() {
    jQuery(".login-username input, .login-password input").each( function ( index, elem ) {
        var element_id = jQuery( elem ).attr( 'id' );
        if( element_id && ( label = jQuery( elem ).parents( '#wppb-login-wrap' ).find( 'label[for=' + element_id + ']' ) ).length === 1 ) {
            jQuery( elem ).attr( 'placeholder', jQuery( label ).text() );
        }
    });
});
```
