我正在尝试实现的是获取锚链接的名称(已完成),但是出于某些奇怪的原因,它在if语句中不起作用。我已经成功地提醒了锚点名称,但是无论它在if语句中不会出现什么。有什么想法吗?
谢谢
echo "<br>
<div id='clicked_linked_$post_id_row' class='comment_field'>
<div id='showit_$post_id_row' style='display:none;'>
<form action='' method='POST''>
<textarea name='comment_post' class='comment_post'placeholder='What Is Your Thought?'></textarea>
<input type='hidden' name='post_id_value' id='post_id_value' class='post_id_value' value='$post_id_row'><br>
<input type='submit' value='Reply'>
</form>
</div>
<small> <a href='#' class='comment_link' id='$post_id_row'> Comment$post_id_row </a> </small>
</div><br>
";
jQuery查询
$(document).ready(function() {
$('.comment_link').click(function() {
var t = $(this).text();
alert(t);
if($(this).text()=='Comment64') {
alert(9);
}
});
$(document).on("click", ".comment_link", function(){
var id = this.id;
$('#showit_'+id).fadeIn(1000);
return false;
});
});
在锚点中,文本周围有空格,即。_Comment64_
而不是Comment64
,哪里_
是空格。见小提琴。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句