我有一些从 mysql 输入的内容,单击时应该触发警报()...但是,这不起作用...
这是我从 php/get_answers.php 输入的代码的代码
<?php session_start(); ?>
<?php require_once("../includes/include_all.php"); ?>
<?php $answers = $question->get_answers_for_question($_GET['id']); ?>
<?php while($row = $answers->fetch_array()){ ?>
<!-- ALL ANSWERS HERE -->
<div class = 'answer-row'>
<div class = 'answer-side'>
<div class = 'arrow-contain-answer' type = 'answer' id = 'arrow-up' answer-id = '<?php echo $row["id"]; ?>'></div>
<div class = 'answer-votes-contain'>
<?php echo $row['popularity']; ?>
</div>
<div class = 'arrow-contain-answer' id = 'arrow-down'answer-id = '<?php echo $row["id"]; ?>'></div>
</div>
<div class = 'answer-content'>
<?php
echo $row['content'];
?>
</div>
<div class = 'actions'>
<a href = '#' class= 'add-comment' id = '<?php echo $row["id"]; ?>'> add comment </a>
</div>
</div>
<?php } ?>
这是它显示的页面上的jquery:
$(".arrow-contain-answer").click(function(){
alert();
});
我想要发生的是当有人单击具有“箭头包含答案”类的元素时,将发生事件..
我认为在通过 mysql/php 将元素“馈入”到页面之前,我遇到了问题。