Solved

Form titles in fields

  • 27 April 2015
  • 5 replies
  • 12 views

I only see an option to put form titles above or to the side of the fields

how do i put the form titles in the fields??

icon

Best answer by ilane_sephira 27 April 2015, 13:24

View original

5 replies

Hi, 
you need to hide labels field and Add a Javascript to write labels IN the form fields.
See /topics/field-label-inside-of-field

will i only see the change in preview? I have tried twice and looked in preview and can not see it - i will keep trying

Did you add the JS below ??

Take care : Placeholders names must be the same in your form settings !!
if not, You’ll need to change these to match the fields in your page that you want to give placeholders to. 

lp.jQuery(function($) {  

 // Define your placeholder texts here, corresponding to Unbounce's field names 

 var placeholders = {



"first_name": "First Name",



"last_name": "Last Name",



"email": "Email" 

 }; 

 // Sets the HTML5 placeholders

 for(var id in placeholders){$("#"+id).attr("placeholder",placeholders[id])} 

 // Polyfill to add support for browsers like IE<=9 

 if(document.createElement("input").placeholder===undefined){$("html").attr("data-placeholder-focus","false");$.getScript("//jamesallardice.github.io/Placeholders.js/assets/js/placeholders.jquery.min.js",function(){$(function(){var e=window.module.lp.form.data.validationRules;var t=window.module.lp.form.data.validationMessages;lp.jQuery.validator.addMethod("notEqual",function(e,t,n){return this.optional(t)||$(t).attr("data-placeholder-active")!=="true"||e!==n},function(e,n){return t[$(n).attr("id")].required});for(var n in placeholders){if($("#"+n).length){if(typeof t[n].required!=="undefined"){e[n].notEqual=placeholders[n]}else{e[n]={}}}}})})} });

Thanks, ilane_sephira! This was super helpful.

Is there a way to change the label color? I have other input fields that are #9c9c9c and it is defaulting to the same gray for the labels which I would like a different color to contrast from the field background.

Thanks!

Reply