Jump to content

How to move placeholder to top on focus AND while typing

Recommended Posts

Hello @CoopperBackpack

You can insert this snippet of code into your submission form Header:

.cbFormFieldCell  {
 position: relative;
 width: 50%;

.cbFormFieldCell  .floating-label {
 position: absolute;
 color: gray;
 font-size: 13px;
 pointer-events: none;
 top: 11px;
 left: 20px;
 transition: 0.2s ease all;

.cbFormFieldCell  input:focus ~ .floating-label,
.cbFormFieldCell input:not(:focus):valid ~ .floating-label {
 top: 0px;
 left: 10px;
 font-size: 10px;
 opacity: 1;
 background-color: white;
 padding: 0 3px;

document.addEventListener("DataPageReady", placeholderHandler);

function placeholderHandler() {
 const labels = document.querySelectorAll('.cbFormLabelCell');
 const inputs = document.querySelectorAll('.cbFormFieldCell');

 for(let i = 0; i < labels.length; i++) {
  if (inputs[i].children[0].type === 'text') {  
   inputs[i].children[0].setAttribute("required", true);

You also can customize the placeholder adjusting the properties in the style tag of the code.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...