You are viewing limited content. For full access, please sign in.

Question

Question

Show a placeholder for email

asked on August 21, 2015

I have an online Application (Form) that users can fill out.  I am looking for a way to provide examples (placeholders) in the fields (Email) to help users understand the accepted values.  Example below.  If I use the 'Default Value' it requires the user to delete this field and input their own value, also this could cause them to accidentally miss on filling out a required field.  

Also, I know I can do this with a masked input, but that creates issues with email addresses because there is not a good way to 'mask' email addresses.  So I was trying something like the code below with no success.  

This one does not allow any text to be entered.  

$.getScript('ServerName/Forms/js/jquery.mask.min.js', function () 
	{ 
      $(".email input").mask("", {placeholder:'example@mail.com'});
    }); //End Field Mask

So, I'm thinking I need to remove the .mask() somehow, but I'm not sure exactly how to do so...  I tried this:

$.getScript('ServerName/Forms/js/jquery.mask.min.js', function () 
	{ 
      $(".email input").placeholder:'example@mail.com';
    }); //End Field Mask

But this does not show a placeholder in the field.  

Any help is much appreciated.

Thanks,

Nate

0 0

Answer

SELECTED ANSWER
replied on August 21, 2015

Hello Nate,

 

I was able to get a place holder with the following code:

 

$(document).ready(function () {

	$(".email input").attr("placeholder", "example@email.com");  
  
});

which looks like

2 0
replied on August 29, 2019

Winston, I am trying to do this same thing on a description field but cannot get it to work. Here's my code:

$(document).ready(function () {
  
	$("#q12 input").attr("placeholder", "example description"); 
  
});

Any ideas?

0 0

Replies

replied on August 21, 2015

Awesome, Thanks Winston!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.