JQuery Forms Focus In

From CoderLearner
Jump to: navigation, search


Bind an event handler to the JavaScript "focusin" event. This event is distinct from the focus event and it can detecting on the parent elements.


$.focusin( handler(event object) )

$.focusin( [event data], handler(event object) )

Example 1

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script src="http://code.jquery.com/jquery-latest.js"></script>
            span {
            $(document).ready(function() {
                $("p").focusin(function() {
            <p><input type="text" name="first" id="first"/><span>First Name</span></p>     
            <p><input type="text" name="second" id="second"/><span>Second Name</span></p>

Try It

Example 2

Focus in and Focus out.

$("#your-field").focusin(function() {
$("#your-field").focusout(function() {

Try It