This is a migrated thread and some comments may be shown as answers.

ComboBoxFor Set Focus

1 Answer 76 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
lmf232s
Top achievements
Rank 1
lmf232s asked on 06 Dec 2010, 03:50 PM
When the page loads I need to be able to set focus on the first combo box. Any ideas?

1 Answer, 1 is accepted

Sort by
0
lmf232s
Top achievements
Rank 1
answered on 13 Dec 2010, 05:55 PM
Ok, I suppose I had a brain fart the other day but i'm pretty sure I tried setting focus on the input thats generated. I did upgrade last week, not saying that had anything to do with it but just trying to make myself feel better.

Given:
<div class="t-widget t-combobox t-header" id="StateId" style="width:50px">
    <div class="t-dropdown-wrap t-state-default">
        <input class="t-input" id="StateId-input" name="StateId-input" type="text" />
        <span class="t-select t-header">
            <span class="t-icon t-arrow-down">select</span>
        </span>
    </div>
    <input id="StateId-value" name="StateId" style="display:none" type="text" />
</div>

Set focus:
$(document).ready(function() {
    $('#StateId-input').focus();
});
Tags
ComboBox
Asked by
lmf232s
Top achievements
Rank 1
Answers by
lmf232s
Top achievements
Rank 1
Share this question
or