Это мой код:
$(document).ready(function(){
var searchDom = document.createElement('div');
searchDom.className = "popContainer";
searchDom.style.cssText = [
'background-color: #ffd700;',
'background-image: -webkit-repeating-linear-gradient(' +
'45deg, transparent, transparent 35px,' +
'rgba(0,0,0,.1) 35px, rgba(0,0,0,.1) 70px);',
'color: #efefef;',
'padding: 10px;',
'font: 14px Arial;'
].join(' ');
document.body.style.cssText = 'position: relative';
document.body.parentElement.insertBefore(searchDom, document.body);
var greeting = "hola";
var button = document.getElementById("navSearch");
button.person_name = "Roberto";
button.addEventListener("keydown", function() {
$('.popContainer').load('popup.html');
alert(greeting);
}, false);
});
Итак, в основном я создаю новый элемент DOM с именем класса «popContainer» и пытаюсь заполнить его содержимым из popup.html, когда пользователь начинает печатать. Это не работает, я попытался использовать .post безуспешно, и я не могу понять, если и как .live будет использоваться здесь.
обратите внимание, что этот файл является частью расширения Chrome и что alert () работает правильно.