I am trying to have my checkbox unchecked after someone confirms the removal of the items. Would like to know how I go about doing so? Hope someone can help me with this.
Here is my code:
JS:
$(".rem-btn").click(function(){
var remConf = confirm("Are you sure you want to remove these items from your shopping list?");
if (remConf == true) {
$(".check-list input:checked").not('#select-all').parent().remove();
};
});
HTML:
<section class="shop-list">
<div class="add-item">
<input id="item-add" type='text' placeholder="Enter item to shopping list..." name="itemAdd"></input>
<button class="add-btn">Add Item</button>
</div>
<div class="item-list">
<h2>Shopping List</h2>
<ul class="check-list">
<li><input type="checkbox" id="select-all"/>Select All</li>
</ul>
</div>
<div class="removal">
<button class="rem-btn">Remove Selected</button>
</div>
</section>
Aucun commentaire:
Enregistrer un commentaire