I have used the script as follows to display simple alert and confirmation. On confirmation if the result is true i have to execute button click code that was written but i am unable to do that
<script type="text/javascript">
$(document).ready(function () {
$("#btn").click(function () {
var inputs = document.getElementsByTagName("input");
var flag = 0;
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type == "checkbox") {
if (inputs[i].checked) {
flag = 1;
break;
}
}
}
if (flag == 0) {
jAlert('Select One', 'Alert Dialog');
}
else {
$("#btn").click(function () {
var inputs = document.getElementsByTagName("input");
var flag = 0;
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type == "checkbox") {
if (inputs[i].checked) {
flag = 1;
break;
}
}
}
if (flag == 0) {
jAlert('Select One', 'Alert Dialog');
//return false;
}
else {
jConfirm('Can you confirm this?', 'Confirmation Dialog', function (r) {
if (r == true)
return true;
else
return false;
});
//return false;
}
});
}
return false;
});
});
</script>
Button click code
protected void btn_Click(object sender, EventArgs e)
{
Response.Write("Hello");
}
But this code is not executing can you help me..