Javascript jQuery确认对话框-冲突类
我正在尝试让确认对话框工作,但我的URL中已经有一个class属性:Javascript jQuery确认对话框-冲突类,javascript,php,jquery,html,function,Javascript,Php,Jquery,Html,Function,我正在尝试让确认对话框工作,但我的URL中已经有一个class属性: <a href="deleteMe.php?key=<?php echo $key; ?> class="load-external" data-target="#right_section">Delete Me</a> 我在下面找到了这个示例,当我使用类“confirmation”时,它在上面的链接中起作用,但我需要使用“load external”,因为它将内容(deleteMe.
<a href="deleteMe.php?key=<?php echo $key; ?> class="load-external" data-target="#right_section">Delete Me</a>
我在下面找到了这个示例,当我使用类“confirmation”时,它在上面的链接中起作用,但我需要使用“load external”,因为它将内容(deleteMe.php)加载回同一个DIV,而不是加载到一个全新的页面中
<a href="deleteMe.php?key=22" class="confirmation">Link</a>
<script type="text/javascript">
$('.confirmation').on('click', function () {
return confirm('Are you sure you want to Delete this record?');
});
</script>
$('.confirmation')。在('click',函数(){
return confirm('您确定要删除此记录吗?');
});
是否有任何方法可以内联执行此操作,或以任何其他方式使其不与我的href链接中必须包含的class=“load external”冲突
谢谢你可以想上多少课就上多少课。例如:
<a href="deleteMe.php?key=22" class="confirmation load-external">Link</a>
简单地写下:
<a href="deleteMe.php?key=<?php echo $key; ?>"
class="confirmation load-external"
data-target="#right_section">Delete Me</a>
您可以在
类
属性字符串中指定任意数量的类。用空格分隔它们。为什么不直接使用.load external
而不是.confirmation
?@ohgod为什么OP可能不想确认所有load external
链接,而只想确认那些归类为confirmation
的链接?正确,我只需要确认定义的链接上的链接。。。。再次感谢。我们可以叫我白痴!:)我不知道我可以使用多个类。工作起来很有魅力。谢谢大家的回复。
<a href="deleteMe.php?key=<?php echo $key; ?>"
class="confirmation load-external"
data-target="#right_section">Delete Me</a>