Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize input frame to get focus by jquery

Shulou Source: shulou.com Published: 2022-06-01 02:17:11 10月04日 Update

This article introduces the knowledge of "how to achieve the focus of the input box by jquery". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Get a simple example of form focus discoloration

/ / .login-form form style class / / .item input input box parent div// focus is the style class $(".login-form") .on ("focus", "input", function () {$(this) .closest ('.item'). AddClass ('focus');}) .on ("blur", "input", function () {$(this) .closest (' .item') .removeClass ('focus');}) / / initialize the user name input box $("# itemBox") .find ("input [name=username]") .focus (); this is the end of the content of "jquery how to achieve the focus of the input box". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Focus content more style knowledge form input practical learned next dilemma example reality situation article case user user name ribbon website Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia macOS Shulou Information MySQL Huawei