Q:

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

0

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

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

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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!" );
});

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now