Tab Index

by Dave Mednick

HTML

Name:
<input tabindex="1" type='text'>
<br>Zip Code:
<input tabindex="2" type='text' id='zip'>
<br>Something Else:
<input class="denied" tabindex="-1" type='text' id='somethingElse'>

JavaScript

$(document).ready(function () {
    $('#zip').keydown(function (e) {
        //if the zero key is pressed
        if (e.keyCode == 48) {
            $(this).blur();
        }
    });
    $('#somethingElse').focus(function () {
        $(this).val('something else when focusing here!');
    });
});