我正在尝试对textbox的foucsin执行一些操作。但是,由于某些原因,该事件从不触发。
$(".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');
}
});
});
});
});发布于 2014-02-26 04:36:16
使用这种方法时,通常需要查找正文或使用contents()访问内容,如下所示
$(this.document).contents().find('#txtAutocompleteContact')但在这种情况下,使用简单的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');
});
}
});
});https://stackoverflow.com/questions/22025468
复制相似问题