2
Answers

Moving to next textarea in gridview.

This is my java script to go to next textbox in gridview while pressing enter. But in my gridview it contains textbox, dropdownlist and buttons. So how can I add dropdownlist and buttons to this code. This code only works for textbox inside the gridview.
 
<script src="https://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$("#GridView1").find("input[type='text']").keydown(function(event) {
if ((event.keyCode == 40 || event.keyCode == 13)) {
event.preventDefault();
var td = $(this).parent().next("td");
if (td.length > 0) {
td.find("input[type='text']").focus();
} else {
var tr = $(this).parent().parent().next("tr");
if (tr.length > 0) {
tr.find("td").first().find("input[type='text']").focus();
}
}
}
})
});
</script>
 
Answers (2)