简体   繁体   中英

confirmation box with just yes button

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>

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

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...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM