dkim18
asked on
setting focus end of line
Hi Experts,
I have the following code for setting focus to the first input element.
I put that in inside of head tag, so it can handle many different forms.
Now, I am trying to set focus end of line if there is already user input. Since there is no id for most text fields and text areas, how do I handle that?
Isn't .get() function doesn't work either.
thanks in advance
I have the following code for setting focus to the first input element.
<script>
$(document).ready(function() {
var first_input = $('input[type=text]:visible:enabled:first, textarea:visible:enabled:first')[0];
if(first_input != undefined){
first_input.focus();
}
});
</script>
I put that in inside of head tag, so it can handle many different forms.
Now, I am trying to set focus end of line if there is already user input. Since there is no id for most text fields and text areas, how do I handle that?
Isn't .get() function doesn't work either.
thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER