PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.16.1
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.16.1
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
profile-builder / assets / js / placeholder-labels.js

placeholder-labels.js in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 3.16.1, at assets/js/placeholder-labels.js

42 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*
2 * Function that adds placeholders to Login Forms and Widget fields
3 *
4 * @since v.2.1
5 *
6 */
7 jQuery( document ).ready( function() {
8
9 // add placeholder to Login Form Fields
10 loginFieldPlaceholder();
11
12 // add placeholder to the 2FA Field
13 loginAuthPlaceholder();
14
15 });
16
17 /**
18 * Add Placeholder for Login Form Fields
19 *
20 */
21 function loginFieldPlaceholder () {
22 jQuery(".login-username input, .login-password input").each( function ( index, elem ) {
23 var element_id = jQuery( elem ).attr( 'id' );
24 if( element_id && ( label = jQuery( elem ).parents( '#wppb-login-wrap' ).find( 'label[for=' + element_id + ']' ) ).length === 1 ) {
25 jQuery( elem ).attr( 'placeholder', jQuery( label ).text() );
26 }
27 });
28 }
29
30 /**
31 * Add Placeholder for 2FA Field on Login Form
32 *
33 */
34 function loginAuthPlaceholder () {
35 let element = jQuery( ".login-auth input" ),
36 element_id = element.attr( 'id' ),
37 label = jQuery( 'label[for=' + element_id + ']' );
38
39 if( element_id && label.length === 1 ) {
40 jQuery( '#' + element_id ).attr( 'placeholder', label.text() );
41 }
42 }