css moving input focus effect

How we can create a moving focus effect for inputs using HTML CSS JS? Solution: See this CSS Moving Input Focus Effect With jQuery, Inputs in Signup Form.

Previously I have shared Input and Placeholder effects, but this is only about focus which has a dynamic moving effect. Basically, there is a separate selector for selecting elements that have focus. The selector is :focus selector, which allowed on elements that accept keyboard events or other user inputs. We can focus on input by click on them or using the TAB button.

Today you will learn to create a dynamic focus on inputs in a signup form. Basically, there is a signup or registration form which has basic input fields like name, email, zip, etc.  And whole form section has a rounded rectangle-shaped border and a signup button at the bottom. The main feature of this program is focus effect, it has a border-line focus effect that moves when we focus on another input.

So, Today I am sharing CSS Moving Input Focus Effect With jQuery. Basically this program is equally based on CSS and jQuery, CSS is for styling the elements and jQuery is applied those style according to action. jQuery is a JS library, that’s why I am putting this post in the JavaScript category. You can use this signup form on your website because it is complete: it has a responsive design, focus effect, and cool UI.

If you are thinking now how this moving focus effect actually is, then see the preview given below.

Preview Of Dynamic Focus Inputs in Signup Form

See this video preview to getting an idea of how this focus effect looks like.

Live Demo

Now you can see this visually, also you can see it live by pressing the button given above. If you like this then get the source code of its.

You May Also Like:

CSS Moving Input Focus Effect With jQuery Source Code

Before sharing source code, let’s talk about it. First I have created the form using HTML <form> tag and placed a span for focus effect, a heading, and inputs for fields inside the form. I have turned off autocomplete on every input and placed placeholder in each text input. Inside some input I have put half value for placing 2 inputs in a line.

Now using CSS I have placed all the elements in the right place, as you can see in the preview. I gave size, position, style, etc to all the elements, to giving style to the inputs I have used input[type=text] in the CSS. And for selecting the submit button I have used input[type=submit] value in the CSS file.

jQuery here handling the moving focus effect in this program. In CSS file I gave style to the focus effect, and jQuery apply the style to the input according to user action. Left all other things you will understand after getting the codes, I can’t explain all in writing. For creating this program you have to create 3 files. First for HTML, second for CSS, and the third for JavaScript. Follow the steps to creating this without any error.

index.html

Create an HTML file named ‘index.html‘ and put these codes given below.

style.css

Now create a CSS file named ‘style.css‘ and put these codes given here.

function.js

The final step, create a JavaScript file named ‘function.js‘ and put the codes.

That’s It. Now you have successfully created CSS Moving Input Focus Effect With jQuery, Inputs in Signup Form. If you have any doubt or question comment down below.

Thanks For Visiting, Keep Visiting.

LEAVE A REPLY

Please enter your comment!
Please enter your name here