我在运行在 JQuery 下运行的第二个进程时遇到问题,如下面的代码。
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head>
<body>
<script type="text/javascript" src='jquery-1.6.2.min.js'> </script>
<div id="displayArea1">
</div>
<br/>
<div id="displayArea2">
</div>
<input id="btnSet" type="button" value="Set The Value" />
<script>
//The input that should i use
var itemToPrintOut1 = "[Input1 (working)] Search <strong style='cursor:pointer' title='Click here'>IP{<span id='ip1'>192.168.2.56,192.168.2.89,192.168.2.75</span>}</strong> that has accessed to MAIL-SERVER{192.168.2.8}";
var itemToPrintOut2 = "[Input2 (not working)] Search <strong style='cursor:pointer' title='Click here'>IP{<span id='ip2'>192.168.2.56,192.168.2.89,192.168.2.75</span>}</strong> that has accessed to MAIL-SERVER{192.168.2.8}";
$("#displayArea1").html(itemToPrintOut1); //If I enable this line, it is works as what i want(because it is using jquery)
$("#btnSet").click(function(){
$("#displayArea2").html(itemToPrintOut2);
});
$("#ip1").click(function(){
alert("Normal method, data = " + $("#ip1").html());
});
$("#ip2").click(function(){
alert("The method I should use, data = " + $("#ip2").html());
});
</script>
</body>
第一次(加载时)它将显示itemToPrintOut1
文本,我可以单击 IP 地址。我对此没有任何意见!
但是当我单击按钮并显示第二个文本itemToPrintOut2
时,我无法再单击 IP。
任何人都可以帮助我如何确保第二个输出也可以与 JQUERY 一起使用。对我来说,有很多事情也与这个问题有关。它与JQuery加载有关吗?
谢谢