我在我的 DOM 上使用event.preventDefault();
for an时遇到问题。ahref
如使用 JQuery 的 HTML 指定的那样,如何防止 url 发布 nofollow 删除?
<td class="trash_can">
<a rel="nofollow" data-remote="true" data-method="delete" data-confirm="Are you sure you want to delete Greek Theater at U.C. Berkeley?" href="/promotions/2/places/46">
<img id="trash_can" src="http://test.dev/images/trash.png?1305741883" alt="Trash">
下面的代码应该会破坏 HTML,但 HTML 在给出“你确定”警告之前会发布一个删除操作。没有什么不工作:
$(function(){
$('.trash_can a').click(function(event) {
event.preventDefault();
console.log('Clicked Delete');
});
});