-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjQuery.php
62 lines (59 loc) · 1.88 KB
/
jQuery.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bootstrap 实例 - 模态框(Modal)插件</title>
<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<h2>创建模态框(Modal)</h2>
<!-- 按钮触发模态框 -->
<a href="javascript:void(0);" class="edit_stock" data-id="99"><button class="btn btn-primary btn-lg" data-toggle="modal" data-id='11'>
开始演示模态框
</button></a>
男<input type="checkbox" value="" name="sex" id="sex">
<button class="btn btn-primary btn-lg" id="btn">测试</button>
<!-- 模态框(Modal) -->
<div class="modal fade" id="myModal" tabindex="99999" 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>
<input type="text" name="name" id="name" value="">
</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>
$(function(){
$('.edit_stock').click(function(){
var id = $(this).data('id');
$('#name').val(id);
$('#myModal').modal();
});
//判断checkbox是否被选中
$('#btn').click(function(){
var sex = $('#sex').prop('checked');
alert(sex);
});
});
</script>
</body>
</html>