I'm trying to select a text field inside the tab, when the tab is clicked.
The jqueryui event is correctly bound - have tested by putting alerts & by replacingfocus()
in the below code with hide()
.
But when I say focus()
, it does not focus inside the text field.
This is for Firefox 3.6.10.
Code as below -
$( "#tabs" ).bind( "tabsselect", function(event, ui) {
console.log("ui.panel: " + ui.panel.id);
var tabName = ui.panel.id;
$("#" + tabName).children("#pointContainer").children('#pointSearchPointForm').children("#searchAndPoint").focus();
});
HTML as below -
<div id="tabs-2">
<DIV id="pointContainer" class="pointContainer">
<FORM id="pointSearchPointForm" name="pointSearchPointForm" METH开发者_JAVA百科OD=POST ACTION="">
<INPUT size="45" TYPE="text" NAME="searchAndPoint" id="searchAndPoint">
<INPUT TYPE="button" class="ui-button ui-state-default ui-corner-all" VALUE="Point Select" ONCLICK="someFunction()">
</FORM>
</DIV>
can't you just call $("#searchAndPoint").focus();
? It's an ID
and supposed to be unique. If it's not unique, then that maybe the prblem.
精彩评论