WordPress.org

Ready to get started?Download WordPress

Forums

Sidebar Login
Placeholder Values (5 posts)

  1. Jimmeh83
    Member
    Posted 1 year ago #

    Firstly, thanks for the plugin.

    I've been trying to figure out how to add placeholder values to the login boxes, so I can remove the labels and save myself a bit of room. After digging for several hours, I found the following section of the sidebar-login.js file:

    var data = {
    			action: 		'sidebar_login_process',
    			security: 		sidebar_login_params.login_nonce,
    			user_login: 	jQuery('input[name="log"]', thisform).val(),
    			user_password: 	jQuery('input[name="pwd"]', thisform).val(),
    			remember: 		remember,
    			redirect_to:	jQuery('input[name="redirect_to"]', thisform).val()

    I'd like to add a placeholder="Username" and placeholder="Password" to the html, but my grasp of JS is tenuous at best.

    If you (or anyone else) can point me in the right direction I'd appreciate it.

    Regards,

    Jim

    http://wordpress.org/extend/plugins/sidebar-login/

  2. Adam Klimowski
    Member
    Posted 1 year ago #

    Try to add this to your sidebar-login.js file:

    $(document).ready(function(){
      $('form').find('input[name="log"]').each(function(ev)
      {
          if(!$(this).val()) {
         $(this).attr("placeholder", "Username");
      }
      });
    });
    
    $(document).ready(function(){
      $('form').find('input[name="pwd"]').each(function(ev)
      {
          if(!$(this).val()) {
         $(this).attr("placeholder", "Password");
      }
      });
    });
  3. schacham
    Member
    Posted 8 months ago #

    I've tried this but it didn't work at all... Does it have any tricks?
    Thanks a lot!

  4. cawo88
    Member
    Posted 8 months ago #

    I just put the above code in my normal script file and it works .thanks Adam

  5. HaraldFM
    Member
    Posted 8 months ago #

    Hi Cawo88, in what normal script file did you put this and where? Thnx in advance!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic