//输入框获取焦点事件
function handleInputFocus() {
console.log('handleInputFocus 2', event);
let pgHtml = $(event.target).prop('ownerDocument').body.innerHTML;//jquery控件所在网页html(不知道为啥直接event点不出ownerDocument)
let currHtml = $(event.target).prop('parentNode').innerHTML;//文本框html
console.log('选中控件html', currHtml);
}
//
var xxx = document.getElementById("demo");
xxx.innerHTML = xxx.ownerDocument.body.innerHTML
// 字符串转正则表达式
function GetRegExp(patternWithFlags) {
// patternWithFlags = "/abc/g";
return new Function('return ' + patternWithFlags)();
}
标签:控件,ownerDocument,innerHTML,html,patternWithFlags,event,页面
From: https://www.cnblogs.com/anjun-xy/p/18141015