好的,所以我使用colorbox弹出PHP生成的动态数据窗口。下面是我的PHP代码...当我点击链接时,窗口弹出数据....但是如果我再次点击相同的链接,窗口没有获取信息,我在控制台a.removeEventListener is not a function
中得到这个,第二次单击颜色框的链接显示..第一次工作..可能出现什么问题?
jQuery(document).ready(function() {
var id_form;
var url;
$("a.madcomment").click(function(e) {
e.preventDefault();
id_form = $(this).attr('id');
url ="#madcomment_menu"+id_form;
$("a.madcomment").colorbox({inline:true, width:"350px", href:url});
});
});
<?php
$select = "SELECT * FROM COMMENTS INNER JOIN Twitter_Data ON Twitter_Data.screen_name=Comments.Twitter WHERE Category ='Comments'";
$result = mysql_query($select);
$result_count = mysql_num_rows($result);
echo " <table border =\"0\">";
echo "<tr>";
$user_array = array();
$counter = 0;
if($result_count > 0) {
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<div id ='scoring_scale' class='madscore".$row['ID']."' style='display:none;'>";
echo "<div id='madcomment_menu".$row['ID']."' style='padding:10px; background:#fff;'>";
echo "<a id='".$row['ID']."' class='green_circle' href='#'> +3 </a>";
echo "<a id='".$row['ID']."' class='orange_circle' href='#'> +1 </a>";
echo "<a id='".$row['ID']."' class='red_circle' href='#'> -1 </a>";
echo "<a id='".$row['ID']."' class='brown_circle' href='#'> -3 </a><br />";
echo"<form>";
echo "<textarea id='text".$row['ID']."'rows='5' cols='33'>";
echo "-";
echo "</textarea>";
echo"<button id='button".$row['ID']."'class='button_madscore'> MadComment </button>";
echo "</form>";
echo "</div>";
echo "</div>";
}
}
// Here is the link that will generate the COLORBOX pop-up
echo "<a id='".$row['ID']."'class=' madcomment' href='madcomment_menu".$row['ID']."'><img src='images/madcomment.png' /> </a>";
?>
答案 0 :(得分:0)
每次锚定点击时你都会绑定你的颜色盒,以防止用下面的颜色替换你的颜色盒代码:
$.fn.colorbox({inline:true, width:"350px", href:url});
这将解决您的问题。