Display a message when the focus is removed from an element using jquery

  • جي كويري

Display a message when the focus is removed from an element.

Note: Here object is similar to an Array of DOM Elements.  using jquery

الأجوبة

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Display a message when the focus is removed from an  element.</title>
</head>
<body>
<form>
<input id="target" type="text" value="Field 1">
<input type="text" value="Field 2">
</form>
<p>Set and remove focus from field1
</p>
</body>
</html>

JavaScript Code :

$( "#target" ).blur(function() {
  console.log( "Remove focus from fields1!" );
});
هل كان المحتوى مفيد؟

معلومات ذات صلة

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...