New to our community ?

Discover a world of possibilities! Join us and explore a vibrant community where ideas flourish and connections thrive.

One of Our Valued Members

Thank you for being part of our community. Your presence enriches our shared experiences. Let's continue this journey together!

Home JavaScript Launch Bootstrap Modal on page load

Launch Bootstrap Modal on page load

Launch Bootstrap Modal on page load

Welcome back to, today we will see how to Launch Bootstrap Modal on page load using JavaScript. so in the very first step we will create a index.html file than we will write our JavaScript code which are helps to show our Bootstrap modal on loading of index.html file.

on page load show modal

In the index.html file we will call the bootstrap.min.js and bootstrap.min.css to load bootstrap files in our web page.


<!DOCTYPE html>

<!-- A Bootstrap Modal -->
<div id="myModal" class="modal fade">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">Subscribe our Newsletter</h4>
            <div class="modal-body">
                <p>Subscribe to our mailing list to get the latest updates straight in your inbox.</p>
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="Name">
                    <div class="form-group">
                        <input type="email" class="form-control" placeholder="Email Address">
                    <button type="submit" class="btn btn-primary">Subscribe</button>

Add the below bootstrap maxcdn files in the head section of index.html

Also Read :
PHP Login Script With Remember me.
Change password using javascript, php and mysqli.
Password and Confirm Password Validation Using JavaScript
Check Email is Already Registered in Database using Ajax and JavaScript.
How to hide extension of html and php file.?

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="">

<!-- jQuery library -->
<script src=""></script>

<!-- Latest compiled JavaScript -->
<script src=""></script>

now we write down our JavaScript code to launch bootstrap modal on the loading of index.html web page. so put the below JavaScript code on the body section of the index file.

<script type="text/javascript">

on the above JavaScript code we called the modal id and change its behavior from fade to show.

just go to the browser and run your index.html file, the bootstrap modal will automatically launch on page load.

Also Read

Check Email is already registered in database with the help PHP, AJAX And JQuery