I have textbox whose visibility is controlled by value selected in telerik dropdown. Say if value selected is yes then textbox is visible else it hides. Now when value in dropdown set to Yes i am not able to set focus to that textbox. Only on pressing 'Tab' key focus moves over there but not as soon as textbox appears. I have tried this code:
我有文本框,其可见性由telerik下拉列表中选择的值控制。假设如果选择的值为yes,那么文本框是可见的,否则它会隐藏。现在,当下拉列表中的值设置为“是”时,我无法将焦点设置为该文本框。只有在按下“Tab”键时,焦点移动到那里,但不会在文本框出现时立即移动。我试过这段代码:
function OnDropDownChange(e){
if ($(this).val() === "Y") {
$("#txtID").show();
$("#txtID").focus();
}
}
Any help will be appreciated.
任何帮助将不胜感激。
2 个解决方案
#1
0
$("#txtID").show(400, function() {
$(this).focus();
});
#2
1
Try this it can be work:
试试这个可以工作:
$('#txtID').show('slow', function() {
$(this).focus();
});
参考
#1
0
$("#txtID").show(400, function() {
$(this).focus();
});
#2
1
Try this it can be work:
试试这个可以工作:
$('#txtID').show('slow', function() {
$(this).focus();
});
参考