Get focus and lose focus events in jquery

Source: Internet
Author: User
<script src="../js/jquery-1.12.4.min.js"></script> <script> $(function(){ // 获取焦点事件,不传参 focus $(‘.one‘).focus(); // 监听焦点事件,能返回 $(‘.one‘).focus(function(){ console.log("获取到焦点!") }) // 失去焦点事件 blur 能返回 $(‘.one‘).blur(function(){ console.log("失去焦点了?") }) // focus()焦点获取.可以返回 // blur()捕捉失去焦点,并返回 }) </script>

The following code is placed in the HTML body

<!-- 焦点事件,即进入界面鼠标定位点,用户可以直接输入 -->    <input type="text" class="one"><br>    <input type="text" class="two">

Get focus and lose focus events in jquery

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.