Reputation: 1
I am a newbie in html and I m trying to set autofocus on an input text field...
But this is not supported in IE... is it possible to use JS in order to solve this problem?
Upvotes: 0
Views: 1860
Reputation: 2244
<input type="text" id="aaa">
<script>
window.onload=function(){
document.getElementById('aaa').focus();
}
</script>
Upvotes: 0
Reputation: 5
Yes you can do this with javascript
e.g.
<script type="text/javascript">
function formfocus() {
document.getElementById('element').focus();
}
window.onload = formfocus;
</script>
Where 'element' is the id of your html input.
Upvotes: 0
Reputation: 6709
Javascript:
document.getElementById('elemID').focus();
jQuery:
$('selector').focus();
Upvotes: 2