1

I have a form and when i click submit i want to display a box saying thank you and some information. Now I just want the box to show OK. So i really dont need a confirmation box but something similar with just an OK button. Can i modify my existing code to achieve it?

<script type="text/javascript">
$(function() { 

    $('form.new').submit(function(){ 

            if (!confirm('Thank you')) { 
                return false; 
            } 
        } 
    }); 

}); 
</script>
Micheal
  • 2,272
  • 10
  • 49
  • 93

2 Answers2

6

instead of confirm use alert(). It only has an ok button.

James L.
  • 4,032
  • 1
  • 15
  • 15
1

You can use an alert instead of a confirm box with just an ok button in it..and it can perform any action after ok is pressed..

Demo

if (!alert('Thank you')) {
          alert('ok clicked');
          return false;  
 }

You can call any javascript function before returning false...

Lucky
  • 16,787
  • 19
  • 117
  • 151