回答編集履歴

1

修正

2019/06/27 01:21

投稿

m.ts10806
m.ts10806

スコア80850

test CHANGED
@@ -20,4 +20,114 @@
20
20
 
21
21
 
22
22
 
23
+ # ほぼ最小構成のコード
24
+
25
+
26
+
27
+ Materializeで組まれているのですからMaterializeの機能を使おうということで。
28
+
23
- ※取り急ぎアドバイスまで。後程最小構成で試したコードを追ます。
29
+ jQuery読れているのjQueryの法に合わせています。
30
+
31
+ クローズは`.modalClose`をあたえれば何とかしてくれるので実装不要です。
32
+
33
+ ```html
34
+
35
+ <!DOCTYPE html>
36
+
37
+ <html lang="ja">
38
+
39
+ <head>
40
+
41
+ <meta charset="UTF-8">
42
+
43
+ <title></title>
44
+
45
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
46
+
47
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
48
+
49
+ </head>
50
+
51
+ <body>
52
+
53
+ <form method="POST" action="/updateItemStates/1" id="states_form">
54
+
55
+ <div class="input-field col s12">
56
+
57
+ <select id="states" class="select" name="states">
58
+
59
+ <option value="1">未執筆</option>
60
+
61
+ <option value="2">請求書挿入</option>
62
+
63
+ </select>
64
+
65
+ <label for="states">ステータス</label>
66
+
67
+ </div>
68
+
69
+ </form>
70
+
71
+ <div class="modal" id="modal01">
72
+
73
+ <div class="overLay modalClose"></div>
74
+
75
+ <div class="inner">
76
+
77
+ <form>
78
+
79
+ <select class="select" onchange="submit(this.form)">
80
+
81
+ <option value="1">タイトル1</option>
82
+
83
+ <option value="2">タイトル2</option>
84
+
85
+ </select>
86
+
87
+ <label for="client_id">登録先の請求書</label>
88
+
89
+ <button class="btn btn-primary">請求書へ挿入</button>
90
+
91
+ </form>
92
+
93
+ <a href="" class="modalClose">Close</a>
94
+
95
+ </div>
96
+
97
+ </div>
98
+
99
+ <script
100
+
101
+ src="https://code.jquery.com/jquery-3.4.1.min.js"
102
+
103
+ integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
104
+
105
+ crossorigin="anonymous"></script>
106
+
107
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
108
+
109
+ <script>
110
+
111
+ $(function(){
112
+
113
+ $('select').formSelect();
114
+
115
+ $('.modal').modal();
116
+
117
+
118
+
119
+ $('#states').on('change',function(){
120
+
121
+ $('#modal01').modal('open');
122
+
123
+ });
124
+
125
+ });
126
+
127
+ </script>
128
+
129
+ </body>
130
+
131
+ </html>
132
+
133
+ ```