如何让jQuery与我的HTML和CSS配合使用?我需要当我点击按钮并打开一个带有一些文本和选项“是”、“否”的中心警报框时,当点击“是”时删除文本。
我的代码在这里:
<div class="text">Some text here
<a href="#" class="deleteMe">
<span class="delete-icon"> x Delete </span>
</a>
</div>
如何让jQuery与我的HTML和CSS配合使用?我需要当我点击按钮并打开一个带有一些文本和选项“是”、“否”的中心警报框时,当点击“是”时删除文本。
我的代码在这里:
<div class="text">Some text here
<a href="#" class="deleteMe">
<span class="delete-icon"> x Delete </span>
</a>
</div>
$(document).on("click", "a.deleteText", function() {
if (confirm('Are you sure ?')) {
$(this).prev('span.text').remove();
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="container">
<span class="text">some text</span>
<a href="#" class="deleteText"><span class="delete-icon"> x Delete </span></a>
</div>
confirm
实际上是 js 而不是 jq :P - Dwza$(function() {
$("#dialog-confirm").dialog({
resizable: false,
height:140,
modal: true,
buttons: {
"Delete all items": function() {
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close");
}
}
});
});
<div id="dialog-confirm" title="Empty the recycle bin?">
<p>
<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>
These items will be permanently deleted and cannot be recovered. Are you sure?
</p>
</div>
$.confirm({
title: 'Confirm!',
content: 'Simple confirm!',
buttons: {
confirm: function () {
$.alert('Confirmed!');
},
cancel: function () {
$.alert('Canceled!');
},
somethingElse: {
text: 'Something else',
btnClass: 'btn-blue',
keys: ['enter', 'shift'], // trigger when enter or shift is pressed
action: function(){
$.alert('Something else?');
}
}
}
});
$.confirm({
content: 'url:hugedata.html' // location of your hugedata.html.
});