jQuery Floating Label – Move Placeholder to Top on Typing

Here is a jQuery Floating Label plugin that smoothly float the placeholder text over the input. This lightweight jQuery plugin get the text from label and insert it as placeholder into an input. Then move this text to top of input on typing.

Plugin Overview

Plugin: Floating Label
Author: Charles Hudson
Licence: MIT Licence
Published: January 17, 2024
Repository: Fork on GitHub
Dependencies: jQuery 1.3.1 or Latest version,
File Type: zip archive (HTML, CSS & JavaScript )
Package Size: 3.17 KB

How to Make jQuery Floating Label

1. Create input filed with label whose placeholder text you want to float.
Note: No need for creating placeholder text, it will automatically inserted from label text.

<label for="name">Name</label>
<input id="name" type="text" />

2. After that, load the jQuery JavaScript library and Floating Label‘s Js file into HTML document.

<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>

<!-- Floating Label Js -->
<script src="js/floating-label.jquery.js" type="text/javascript"></script>

3. Finally, call the plugin with label selector in jQuery document ready function.




Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link