Mam formularz HTML i po naciśnięciu enter
wybierane jest następne pole.
tutaj jest kod.Wybór następnego pola przy naciśnięciu enter przy użyciu jquery
$(document).on("keydown","input",function(event) {
\t if (event.which === 13) {
\t \t event.stopPropagation();
\t \t event.preventDefault();
\t \t $(this).nextAll("input").eq(0).focus();
\t }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
\t <table>
\t \t <tr>
\t \t \t <td>Medical Record No.</td><td><input type="text" name="labNo" /></td>
\t \t </tr>
\t \t <tr>
\t \t \t <td>Age/sex </td><td><input type="text" name="age" />
\t \t \t \t <select id="age">
\t \t \t \t \t <option value="Year">Year</option>
\t \t \t \t \t <option value="Month">Month</option>
\t \t \t \t </select>
\t \t \t \t <select id="sex">
\t \t \t \t \t <option value="Male">Male</option>
\t \t \t \t \t <option value="Female">Female</option>
\t \t \t \t </select>
\t \t \t </td>
\t \t </tr>
\t \t <tr>
\t \t \t <td>Phone </td>
\t \t \t <td><input type="text" name="" value="-,-" /></td>
\t \t </tr>
\t \t <tr>
\t \t \t <td colspan="2"><input type="button" id="patBtn" value="Save (S)" accesskey="s" />
\t \t \t \t <input type="reset" value="Set Default (D)" accesskey="d" />
\t \t \t </td>
\t \t </tr>
\t </table> \t
</form>
To nie działa.
jak to zrobić w opcji 'wybierz' również. @A_funs – Axeem
działa w firefoxie i safari –
właściwie to zmieniłem, dodałem też keyup, jak się wydaje działa we wszystkich przeglądarkach teraz –