开发者

Jquery + jqueryui - focusing on text field not working for FireFox

开发者 https://www.devze.com 2023-01-17 14:53 出处:网络
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 replacing focus() in the below code with hide

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 replacing focus() 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号