How to disable the mode box of Bootstrap so that it does not pop up

problem description

use Bootstrap modal box plug-in to write a modal box, now I judge the value of input, the judgment failed, so that the modal box does not pop up, I would like to ask how to disable the pop-up of the modal box.

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)
< div class= "modal fade" id= "Modal10" 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">
                            
                        </h4>
                    </div>
                    <div class="modal-body">
                        <div>
                            <lable>:</lable>
                                <span id="yzMin"></span>    
                                <input type="text" placeholder=":-20-101020" id="number">
                                <span id="yzMax"></span>
                                <span id="yzName" style=" visibility:hidden; "></span>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" id="fangBtn1" class="btn btn-primary" onclick="addYZ()"  data-toggle="modal" data-target="-sharpModal11" ></button>
                        <button type="button" class="btn btn-default" data-dismiss="modal"></button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
        <!--  -->
        <div class="modal fade" id="Modal11" 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" style="float:left">
                            CPK
                        </h4>
                        <button type="button" class="btn btn-default" style="background-color:-sharp337ab7;color:-sharpfff;margin-top:3px;float:right" id="btn_upload7" ></button>
                    </div>

what result do you expect? What is the error message actually seen?

Aug.24,2021

do not open the modal box by giving a node data-target ='- sharpModal10'
in the following way

if(input){    // 
 $('-sharpModal10').modal('show');
}

$('- sharpModal10'). Modal ('hide');


show.bs.modal : This event fires immediately when the show instance method is called. If caused by a click, the clicked element is available as the relatedTarget property of the event.

the show.bs.modal event is triggered before the modal is displayed, so try blocking the event e.preventDefault (); or calling $('- sharpModal10'). Modal ('hide');

$('- sharpModal10'). On ('show.bs.modal', function (e) {

)

/ / $('- sharpModal10'). Modal ('hide');

or

/ / e.preventDefault ();

})


//
function addYZ(){
            var number = $("-sharpnumber").val();
            if(number == "" || number.replace(/\s*/g, "") == "") {
                alert("");
                $("-sharpbtn_upload8").attr("disabled", "disabled")
            } else {
                $("-sharpbtn_upload8").removeAttr("disabled")
                }              
            names=$("-sharpyzName").html();
            var data={
                        id:id,
                        name:names
               }                         
                };
        //        
                $("-sharpnumber").change(function() {
                    var number = $("-sharpnumber").val();
                    if(number == "" || number.replace(/\s*/g, "") == "") {
                        alert("");
                        $("-sharpbtn_upload8").attr("disabled", "disabled")
                    } else {
                        $("-sharpbtn_upload8").removeAttr("disabled")
                        }              
                });            
Menu