Reputation: 4578
I used the codes here http://jsfiddle.net/0gct8qd8/ to create a modal dialog when the submit button is pressed. But what should I do if I want to, let's say, due to certain condition is not met (eg the last name's length is less than 3), I don't want the modal dialog to be displayed.
Here's what I done so far but to no avail
$('#submitBtn').click(function() {
if (verifyAllInput() == true){
$('#confirmNRIC').text($('#ID').val());
$('#confirmMobile').text($('#MobileNo').val());
$('#confirmEmail').text($('#Email').val());
}else{
//this part here should make the modal not being displayed
alert("ttaa");
$( "#confirm-submit" ).hide();
}
});
Upvotes: 0
Views: 56
Reputation: 7777
You need to show model programmatically. Remove from #submitBtn
attribute data-toggle
and add to your script $('#confirm-submit').modal('show');
.
Upvotes: 1