为什么这个脚本不起作用?我想输入 parent_id 的值,请告诉我该怎么做
<script src="http://localhost/ci/social/assets/jquery/jquery-1.7.1.js"></script>
<script type="text/javascript" >
$(document).ready(function(){
$(".comment_link").click(function(e){
e.preventDefault();
var element = $(this);
var id = element.attr("post_id");
var gi = element.attr("grand_id");
var pi = element.attr("parent_id");
$("#parent_id_"+id).val(id);
return false;
});
});
</script>
<a href="#" post_id="1" grand_id="0" parent_id="2" class="comment_link">Comment</a>
<input type="text" id="parent_id_2" value="" name="parent_id">