Catatan Pekerjaan

Website ini merupakan sarana untuk mengekspresikan apa yang saya pikirkan daripada ngruntel/nggedibal di otak, jadi lebih baik saya menuangkan disini

How To re-Focus To a Text Field When Focus is Lost on a HTML Form?

How To re-Focus To a Text Field When Focus is Lost on a HTML Form?

How to re-focus to a text field when focus is lost on a HTML form?

HTML:

<input type='text' id='thingy' onblur="refocus(this);">

Script:

function refocus(elm) {

    setTimeout(go, 0);

    function go() {
        elm.focus();
    }
}

Post a Comment