JavaScript Tutorial/jQuery/blur

Материал из Web эксперт
Перейти к: навигация, поиск

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

    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
            $("input").focus(function () {
     <p><input type="text" /> <span>focus event fire</span></p>

To triggers the blur event on all paragraphs: