首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >focusin事件使用不触发

focusin事件使用不触发
EN

Stack Overflow用户
提问于 2014-02-26 04:29:18
回答 1查看 176关注 0票数 0

我正在尝试对textbox的foucsin执行一些操作。但是,由于某些原因,该事件从不触发。

代码语言:javascript
复制
$(".ddlAddListinTo li").click(function () {
    var urlstring = "../ActionTypes";
    $.post(urlstring, function (data) {
        $(window.open(urlstring, 'Contacts', 'width=750, height=400')).load(function (e) {

      //  Here "this" will be the pop up window. 
             $(this.document).find('#txtAutocompleteContact').on({
                   'focusin': function (event) {
                   alert('You are inside the Contact text box of the Contacts Popup');
                         }
                    });
               });
         });
});
EN

回答 1

Stack Overflow用户

发布于 2014-02-26 04:36:16

使用这种方法时,通常需要查找正文或使用contents()访问内容,如下所示

代码语言:javascript
复制
$(this.document).contents().find('#txtAutocompleteContact')

但在这种情况下,使用简单的javascript似乎更合适:

代码语言:javascript
复制
$(".ddlAddListinTo li").on('click', function () {
    var urlstring = "../ActionTypes";
    $.post(urlstring, function (data) {
        var wind = window.open(urlstring, 'Contacts', 'width=750, height=400');

        wind.onload = function() {
             var elem = this.document.getElementById('txtAutocompleteContact');

              $(elem).on('focus', function() {
                  alert('You are inside the Contact text box of the Contacts Popup');
              });
         }
    });
});
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22025468

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档