For some reason, when I am nesting if statements, it seems to bypass
the first if, and go right to the second one, even if the value of
#duplicateInput is more than 10.  I want the statement to check to see
if the input field has a number that is equal or less than 10, then,
if it is, throw an alert making sure they want to delete multiple
items.

If the number is higher than 10, an alert will let them know they need
to enter a lower number.

Did I do something wrong here?

//Add click function and confirm to mass delete confirm button
$("#massRemoveAssetConfirm").click(function() {
    var dulicateCheck = $("#duplicateInput").val();
    if (dulicateCheck <= 10) {
        //Confirm that we want to mass delete assets
        var answerDelete = confirm("Are you sure you want to delete
multiple assets? This cannot be undone!");
        if (answerDelete) {
            //Find all checkboxes that are checked, and put their
values into an array
            $
("#adminToolsHoldListing :checkbox:checked").each(function() {
                // Pass the values to ajax post
                $.ajax({
                    type: "POST",
                    url: this.value + "?action=delete"
                });
            });
            //Hide the asset we just delete from the asset list
            $("#adminToolsHoldListing .scroll
input:checked").parent(".deleteCheck").parent(".itemHolder").hide();
            //Remove the contents of the iframe, for the current asset
that we deleted
            $("#assetEditFrame").contents().html("");
        }
    } else {
        alert("You are limited to 10 duplicates or less, please adjust
your value.");
        $("#duplicateInput").val("");
        return false;
    }
});

Reply via email to