function autofocus(selector) { $(function () { $(selector)[0].focus(); }); }