侧边栏壁纸
  • 累计撰写 781 篇文章
  • 累计创建 1 个标签
  • 累计收到 1 条评论
标签搜索

弹窗

Dettan
2021-04-10 / 0 评论 / 0 点赞 / 109 阅读 / 2,750 字
温馨提示:
本文最后更新于 2022-04-30,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

<!--模态框 和 a标签的 data-target="#modal-add" 结合可以用模态框弹出子页面-->
<a style="float: right" type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-add" href="user.jsp"> 管理用户 </a>

<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modal-change" data-type="random">修改</button>

$('#modal-change').on('show.bs.modal', function (event) {
$("#modal-names").empty();
var button = $(event.relatedTarget); // Button that triggered the modal
//var type = button.data('type'); // Extract info from data-* attributes
var modal = $(this);
tdName=button.parent().prev();
console.log(tdName);
modal.find("input").val(tdName.text());
//
modal.find('.modal-btn').off();
modal.find('.modal-btn').on("click", function () {
var question = $("#showQuestion").find('.t-question-one').val();

    $.ajax({
        url: &quot;{:url('teacher/teaching/askQues')}&quot;,
        type: &quot;post&quot;,
        data: &quot;id=&quot; + ids + &quot;&ques=&quot; + question,
        success: function (data) {
            //data=JSON.parse(data);
            //评分模态按钮显示
            //showMessage(data)
            if (question == &quot;&quot;) {
                $(&quot;#wait2&quot;).append($(&quot;#modal-names&quot;).children());
            } else {
                $(&quot;#wait1&quot;).append($(&quot;#modal-names&quot;).children());
                $(&quot;#wait1 btn&quot; + data['stuId']).data('quesId', data['quesId']);
            }
        }
    });
    modal.modal('hide');
})

$("#modal-names").empty();
<!--弹出框-->
<div class="modal fade" id="modal-add" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form class="form-inline">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">添加学院</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>学院名</label>
<input type="text" class="form-control" name="name" placeholder="完整学院名">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="modal-btn btn btn-primary" >添加</button>
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->




0

评论区