我遇到了IE6和javascript应用于ajax内容的问题
我无法在使用ajax检索的内容上使用任何类型的javascript(plain或jQuery)。
我有我的主html页面用ajax加载Header内容(对于这个任务,我使用的是jQuery .load()方法)
像
<html>
<body>
<div id="header">
... here the content that comes from the ajax call...
(i.e. <div id="myText">myText loaded with ajax</div>)
...
现在我正在尝试为此内容添加一些事件。这在Firefox和Chrome中运行良好,但在IE6中运行不正常。我尝试使用jQuery live(),在ajax内容中加载的普通javascript但什么都没有。 IE不喜欢它。 你对这个问题有什么解决方法吗? 感谢
更新的
我正在使用的脚本就像这样
$("#goButton").live("click", function(){
$search = $('#searchPhrase');
if ($search.val() == $search.attr('title')) {
$search.val('');
}
});
这是使用Ajax调用加载的内容
<form id="s" action="/searchresults.jsp">
<input type="text" id="searchPhrase" title="Search" value="Search"/>
<input type="image" alt="Search this Website" src="/images/go_button.png" id="goButton"/>
</form>
无论如何,渲染的页面非常大,但是如果我不考虑ajax内容,那么每个jQuery或js在IE中工作正常。