-
Notifications
You must be signed in to change notification settings - Fork 0
/
0440_form_input_append_prepend.html
68 lines (68 loc) · 2.54 KB
/
0440_form_input_append_prepend.html
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
63
64
65
66
67
68
<!-- 入力フィールドの前にフィールドの一部っぽいテキストをくっつけるには? -->
<!-- div.input input-prepend span.add-on input で前 -->
<!-- 前後につけることはできない -->
<!DOCTYPE html>
<html lang="ja">
<html>
<head>
<meta charset="UTF-8" />
<link href="assets/bootstrap.css" media="screen" rel="stylesheet" type="text/css" />
<script src="assets/jquery.js" type="text/javascript"></script>
<script src="assets/coffee-script.js" type="text/javascript"></script>
<script src="assets/bootstrap.js" type="text/javascript"></script>
<script type="text/coffeescript">
$ ->
$(".add-on :checkbox").on "click", ->
if $(this).attr("checked")
method = "addClass"
else
method = "removeClass"
$(this).parents(".add-on")[method]("active")
</script>
</head>
<body>
<div class="container">
<form class="form-horizontal">
<div class="control-group">
<label class="control-label">一部だけを入力させる</label>
<div class="controls">
<div class="input-prepend">
<input type="text" />
<span class="add-on">http://</span>
</div>
<div class="input-append">
<input type="text" class="input-small" />
<span class="add-on">@docomo.co.jp</span>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">アイコン指定</label>
<div class="controls">
<div class="input-prepend">
<input type="text" />
<label class="add-on"><i class="icon-envelope"></i></label>
</div>
<div class="input-append">
<input type="text" />
<label class="add-on"><i class="icon-envelope"></i></label>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">チェックボックス</label>
<div class="controls">
<div class="input-prepend">
<input type="text" />
<label class="add-on active"><input type="checkbox" checked="checked" /></label>←ずれるのはなぜだろう?
</div>
<div class="input-append">
<input type="text" />
<label class="add-on active"><input type="checkbox" checked="checked" /></label>
</div>
</div>
</div>
</form>
</div>
</body>
</html>