JavaScript Tutorial/jQuery/blur
Версия от 18:52, 25 мая 2010; (обсуждение)
blur(fn): blur event fires when an element loses focus
To pop up an alert every time any paragraph"s blur event triggers:
$("p").blur( function () { alert("Hello World!"); } );
Stop people from writing in text input boxes
<html>
<head>
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("input").focus(function () {
$(this).blur();
});
});
</script>
</head>
<body>
<body>
<p><input type="text" /> <span>focus event fire</span></p>
</body>
</html>
To triggers the blur event on all paragraphs:
$("p").blur();