我有一个嵌套的SPAN里面的另一个跨度没有被拾起我的jQuery - 我想都找到一种方法来使这项工作,并找出它为什么不是加工。嵌套跨度没有采取onClick
基本上,我有一个跨度,这实际上是一个弹窗(引导) 它的意思是确认删除记录。
下面是我有:
<span
class="glyphicon glyphicon-remove"
data-placement="top"
data-toggle="popover"
style="cursor:pointer"
title="Confirm"
data-content="<center><span style='cursor:pointer' id='deleteRecordSpan' class='remove glyphicon glyphicon-remove'><p style='display:none'><?=$row['uniqueID'];?></p></span></center>"
></span>
跨度的数据内容的内部假设是第2个按钮(实际挂钩到jQuery的做我的AJAX命令按钮) - 和按钮出现并且具有与它相关的正确信息,但点击时,它永远不会触发jQuery的事件(按萤火虫)
我的JS:
<script>
$(document).ready(function() {
$('.remove').click(function() {
var input = input = $(this).text()
$.ajax({ // create an AJAX call...
data: {
uniqueid: input,
},
type: 'POST', // GET or POST from the form
url: './ajax/deleteRecord.php', // the file to call from the form
success: function(response) { // on success..
show10();
allToday();
}
});
});
});
</script>
我可能是错的,但我认为引导具有stopPropagation对它们的元素,防止东西下面醒目的点击事件。我认为如果你能绕过你,你就是金。或者直接使用z-index和绝对值。 – Chris
@Chris我不想因为这个而破坏我的网站的任何其他功能 - 我如何通过z-index和绝对路径将其移动? – GrumpyCrouton
为什么你的HTML处于'data-content'属性,是一个错字,还是应该是这样?如果是后者,则标记由Bootstrap动态插入,并且您需要一个委托事件处理程序 - >'$(document).on('click','.remove',function(){...' – adeneo