modal


<button type="button" class="btn btn-primary" id="change">更改密码</button> <div class="row"> <!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">触动模态框</button> --> <div id="myModal" tabindex="-1" class="modal fade" role="dialog"> <div class="modal-dialog modal-sm" style="background-color: #FFFFFF;"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title">Title</h4> </div> <div class="modal-body"> <form class="form"> <div class="form-group"> <label for="username">UserName</label> <input type="text" class="form-control" name="username" /> </div> <div class="form-group"> <label for="password">Password</label> <input type="password" class="form-control" name="password" /> </div> <div class="form-group"> <label for="confirmPassword">confirmPassword</label> <input type="password" class="form-control" name="confirmPassword" /> </div> </form> </div> <div class="modal-footer text-center"> <div class="form-group"> <button type="button" class="btn btn-sm btn-primary form-control" id="save">保存</button> </div> </div> </div> </div> </div>
$('#save').click(function(){
        let data = {
            'username': $('input[name="username"]').val(),
            'password': $('input[name="password"]').val(),
            'confirmPassword': $('input[name="confirmPassword"]').val()
        };
        console.log(data);
// 执行操作 // $('#myModal').modal('hide'); 关闭模态框 }); // 显示模态框 $('#change').click(function(){ $('#myModal').modal('show'); //开启模态框 });

 

上一篇:工厂模式


下一篇:android java js 回调 真心好用