使用twitter bootstrap无法在jQuery UI模式内的文本框中聚焦

时间:2012-11-26 11:38:39

标签: javascript jquery twitter-bootstrap

我无法将文本框聚焦在单击下拉列表的窗格中,如图所示: enter image description here

以下是我正在使用的代码:

          $("#dialog-modal").dialog({
          title: "Upload to: FolderNameGoesHere",
          width: 720,
          height: 450,
          dialogClass: "file-upload-modal",
          modal: true,
          buttons: {
              "Save": function () {
                  $(this).dialog("close");
              },
              "Cancel": function () {
                  $(this).dialog("close");
              }
          }
      });

      // Fix input element click problem
      $('.input-append').click(function (e) {
          //$(this).focus();
          e.stopPropagation();

      });​

这是现场js小提琴http://jsfiddle.net/5nDUf/1/

1 个答案:

答案 0 :(得分:1)

莫代尔试图偷走你身边的一切:)

$('.input-append').click(function (e) {
    //$(this).focus();
    e.stopPropagation();

});​

应该是

// Fix input element click problem
$('.input-append').bind('click mouseup mousedown keypress keydown keyup', function (e) {
    e.stopPropagation();
});​

小提琴http://jsfiddle.net/jaMda/