Form field margins - not working on live site

  • 14 February 2017
  • 7 replies
  • 2 views

Userlevel 6
Badge +3

I’m using some custom .js and CSS to style my form on this page: https://www.detoxcleansenourish.com/blitz/
Something is not working in the styling though as the margins or padding seem to have disappeared.

However, the same .js and CSS is working fine on https://www.detoxcleansenourish.com/

Can anyone see what I’ve done wrong?! 🙂


7 replies

Userlevel 7
Badge +3

Hi @Zoe_Tattersall,

The floatlabels.js script you’ve added is breaking your form.

Best,
Hristian

Userlevel 6
Badge +3

Hi @Hristian 🙂 I don’t understand though - I have the same floatlabels.js on the www.detoxcleansenourish.com site and it’s not breaking the form???

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/derpoho/floatlabels.js/master/floatlabels.js"></script>

<script>
$(document).ready(function () {
$('.lp-pom-form :input').floatlabel({
slideInput: false,
transitionDuration: .2
}); $('.lp-pom-form .lp-pom-button').click(function(){
if (lp.jQuery('.lp-pom-form form').valid()) { $('.label-floatlabel').css({ opacity: 0 });
} $(".lp-pom-form :input").keyup(function(){ $("label[for='"+this.id+"']").css({ opacity: 1 }); });
}); $('.lp-pom-form').keypress(function(event) { if (event.which == 13) { if (lp.jQuery('.lp-pom-form form').valid()) { $('.label-floatlabel').css({ opacity: 0 });
} } $(".lp-pom-form :input").keyup(function(){ $("label[for='"+this.id+"']").css({ opacity: 1 }); }); }); }); </script>

Userlevel 6
Badge +3

@Hristian if you can fix this please give me a quote as I still haven’t figured it out! 😃

Userlevel 7
Badge +3

Hi @Zoe_Tattersall,

A few lines JS are messing up your form.

If you comment out these lines, it should work fine:

$('.lp-pom-form :input').floatlabel({
    slideInput: false,
    transitionDuration: .2
  });

This is how the form looks before these lines run:

This is how the form looks after they run:

Let me know if you run into more problems.

Best,
Hristian

Userlevel 6
Badge +3

That worked perfectly! Thank you!!! 😃

Userlevel 7
Badge +3

No problem Zoe.

However, there is a much simpler way to display placeholder text inside your fields without using this floatlabel.js.

Here is the official docs for it.

Floatlabels.js adds more “weight” to your page without actually using it for the purpose it was build - floating the label to the top of the field once you start typing.

Best,
Hristian

Userlevel 6
Badge +3

Thanks for that! Didn’t see your reply – will change it over 🙂

Reply