How does the modal box of Bootstrap pop up by itself?

when learning Bootstrap:

http://www.runoob.com/try/try.

this

<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="-sharpmyModal">
    
</button>

Click the button and the modal box pops up. Which variable does it use to make the modal box pop up?

I want to enter the page and modal directly pops up if that variable doesn"t exist, instead of clicking the button and popping up again.

Mar.28,2021

check the official document first
https://v3.bootcss.com/javasc.

if you encounter problems.


look at the documents for yourself. After the page is loaded, you can call api to trigger it.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"> 
    <title>Bootstrap  - Modal</title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <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" id="myModalLabel">
                    Modal
                </h4>
            </div>
            <div class="modal-body">
                
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">
                </button>
                <button type="button" class="btn btn-primary">
                    
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
    <script type="text/javascript">
            
          $(function(){
                   $('-sharpmyModal').modal('show')
          });
   </script>
</body>
</html>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38dd7-2c12d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38dd7-2c12d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?