7
Answers

Jquery to load page automatically

Schleid Alex

Schleid Alex

4y
510
1
Hi there,
I have a view with an input field and a button when the button is clicked it triggers a jquery function to check where the value in the field is null or not if null I show a jquery alert saying the value cannot be nul
here is the script
 
$(document).ready(function(){
$('#btnAdd).on('click', function(){
if($('#Quantity).val()>0) 
{
....
}
else
{
alert('Quantity cannot be null')
}
})
 my problem is after the alert is displayed it goes straight to the index page instead of staying on the create one. I dunno why, could someone help me out please
 
Regard
 
Schleid
Answers (7)