I have a delete hyper link
<a href="#" class="btn btn-danger btn-mini" id="delCategory">Delete</a>
and my Jquery function
$(document).ready(function()
{
$("#password_validate").validate({
rules:{
current_pwd:{
required: true,
minlength:6,
maxlength:20
},
new_pwd:{
required: true,
minlength:6,
maxlength:20
},
confirm_pwd:{
required:true,
minlength:6,
maxlength:20,
equalTo:"#new_pwd"
}
},
errorClass: "help-inline",
errorElement: "span",
highlight:function(element, errorClass, validClass) {
$(element).parents('.control-group').addClass('error');
},
unhighlight: function(element, errorClass, validClass) {
$(element).parents('.control-group').removeClass('error');
$(element).parents('.control-group').addClass('success');
}
});
$("#delCategory").click(function(){
alert("Test");
if(confirm('Are you sure you want to delete this Category?')){
return true;
}
return false;
});
});
My other parts of the code can access the #password_validate
and make sure the password field is required and all. But the #delCategory
from the same HTML page is unable to access the function and return confirmation.
I am able to call the Jquery function from Chrome Console and get the pop-up and confirmation, but my href is failing to call it and it processes the delete without confirming.