如何在客户端单击时将焦点设置在 DevExpress 组合框的“SelectedIndexChange”事件的 <inp
How to set focus on <input type="text" /> on "SelectedIndexChange" event of an DevExpress combobox at client click?
function DefaultText(textBox) {
textBox.focus(function()
{
if ($(this).val() == $(this)[0].title)
{
$(this).removeClass("activecss");
$(this).val("");
}
});
textBox.blur(function()
{
if ($(this).val() == "")
{
$(this).addClass("deactivatecss");
$(this).val($(this)[0].title);
}
});
textBox.blur();
}
当文档加载成功时,将调用上述函数。
形式.aspx
<dx:ASPxComboBox ID="comboBoxAttributes" SelectedIndexChanged="function(s, e) { $('#textBox').focus(); }" />
</dx:ASPxComboBox>
现在它得到了 mili sec. 的焦点,然后转到 ASPxComboBox 的选定文本。
将单击事件绑定到按钮并调用 .focus(( 以触发焦点事件:
在下拉列表中绑定更改事件并调用 .focus(( 以触发焦点事件:
$('#dropdown').change(function() {
$('#textbox').focus();
});
注意:将"#dropdown"和"#textbox"分别替换为下拉菜单和文本框的选择器。
延伸阅读:
- 绑定变更事件
- .focus((
<input type="button" id="button" value="Button"/>
$("#button").click(function(){
textBox.trigger("focus");
});
使用以下行聚焦特定文本框
$("#button").click(function(){
$("#id").focus();or $('.classname').focus();
});
相关文章:
- 没有找到相关文章