質問編集履歴
2
JS部分も追加しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -83,4 +83,137 @@
|
|
83
83
|
font-size: 13px;
|
84
84
|
color: #0081d6;
|
85
85
|
margin-left: 40px;
|
86
|
-
}
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
<追記>
|
90
|
+
|
91
|
+
下記のような形で、チェックボックスを作成しました。
|
92
|
+
このチェックボックスがチェックされていないときはdisabledをボタン(id:buttonx) につけて
|
93
|
+
チェックされている場合はdisabledを外すということをしたいのですが、うまくいきません。
|
94
|
+
|
95
|
+
|
96
|
+
【コンタクトフォーム 7】
|
97
|
+
<div class="item">
|
98
|
+
<label class="label">同意事項</label>
|
99
|
+
|
100
|
+
<label class="c-checkbox">
|
101
|
+
|
102
|
+
<input type="checkbox" name="checkbox01[]" class="checkbox01-input" id="check"></input>
|
103
|
+
<span class="checkbox01-parts">プライバシーポリシーに同意</span>
|
104
|
+
<a href="https://yorozutokei.co.jp/privacypolicy/">プライバシーポリシーはこちら</a>
|
105
|
+
</label>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
<div class="btn-area">
|
109
|
+
[response]
|
110
|
+
[submit class:input id:buttonx]
|
111
|
+
</div>
|
112
|
+
|
113
|
+
</form>
|
114
|
+
|
115
|
+
【CSS】
|
116
|
+
.checkbox01-input{
|
117
|
+
display: none;
|
118
|
+
}
|
119
|
+
.checkbox01-parts{
|
120
|
+
padding-left: 20px;
|
121
|
+
position:relative;
|
122
|
+
margin-right: 20px;
|
123
|
+
}
|
124
|
+
.checkbox01-parts::before{
|
125
|
+
content: "";
|
126
|
+
display: block;
|
127
|
+
position: absolute;
|
128
|
+
top: -5px;
|
129
|
+
left: -15px;
|
130
|
+
width: 25px;
|
131
|
+
height: 25px;
|
132
|
+
border: 1px solid #C4BCB4;
|
133
|
+
border-radius: 2px;
|
134
|
+
}
|
135
|
+
|
136
|
+
.checkbox01-parts::after{
|
137
|
+
content: "";
|
138
|
+
display: block;
|
139
|
+
position: absolute;
|
140
|
+
top: 0px;
|
141
|
+
left: -5px;
|
142
|
+
width: 7px;
|
143
|
+
height: 14px;
|
144
|
+
transform: rotate(40deg);
|
145
|
+
border-bottom: 3px solid #C4BCB4;
|
146
|
+
border-right: 3px solid #C4BCB4;
|
147
|
+
border-radius:2px;
|
148
|
+
}
|
149
|
+
|
150
|
+
.checkbox01-input:checked + .checkbox01-parts::after{
|
151
|
+
content: "";
|
152
|
+
display: block;
|
153
|
+
position: absolute;
|
154
|
+
top: 0px;
|
155
|
+
left: -5px;
|
156
|
+
width: 7px;
|
157
|
+
height: 14px;
|
158
|
+
transform: rotate(40deg);
|
159
|
+
border-bottom: 3px solid #fff;
|
160
|
+
border-right: 3px solid #fff;
|
161
|
+
border-radius:2px;
|
162
|
+
}
|
163
|
+
|
164
|
+
.checkbox01-input:checked + .checkbox01-parts::before{
|
165
|
+
background-color:#3C2207;
|
166
|
+
}
|
167
|
+
|
168
|
+
|
169
|
+
.main .inner form .checkbox .wpcf7-form-control:checked + .check:after {
|
170
|
+
content: "";
|
171
|
+
display: block;
|
172
|
+
position: absolute;
|
173
|
+
top: -5px;
|
174
|
+
left: -10px;
|
175
|
+
width: 25px;
|
176
|
+
height: 25px;
|
177
|
+
background: #3C2207;
|
178
|
+
border-radius: 5px;
|
179
|
+
}
|
180
|
+
|
181
|
+
.main .inner form .checkbox .check {
|
182
|
+
padding-left: 20px;
|
183
|
+
position: relative;
|
184
|
+
margin-right: 20px;
|
185
|
+
}
|
186
|
+
|
187
|
+
.main .inner form .checkbox .check:before {
|
188
|
+
content: "";
|
189
|
+
display: block;
|
190
|
+
position: absolute;
|
191
|
+
top: -5px;
|
192
|
+
left: -10px;
|
193
|
+
width: 25px;
|
194
|
+
height: 25px;
|
195
|
+
border: 1px solid #999;
|
196
|
+
border-radius: 5px;
|
197
|
+
}
|
198
|
+
|
199
|
+
.main .inner form .c-checkbox a {
|
200
|
+
font-size: 13px;
|
201
|
+
color: #0081d6;
|
202
|
+
margin-left: 40px;
|
203
|
+
}
|
204
|
+
|
205
|
+
【JS】
|
206
|
+
$('.checkbox01-input').change(function () {
|
207
|
+
// チェックが入っていたら有効化
|
208
|
+
if ($(this).is(':checked')) {
|
209
|
+
// ボタンを有効化
|
210
|
+
$('#buttonx').prop("disabled", false);
|
211
|
+
} else {
|
212
|
+
// ボタンを無効化
|
213
|
+
$('#buttonx').prop("disabled", true);
|
214
|
+
}
|
215
|
+
});
|
216
|
+
|
217
|
+
|
218
|
+
この記載だとチェックが入っていてもいなくても、送信ができてしまいます、、、
|
219
|
+
どなたかご教授いただけないでしょうか。
|
1
チェックボックスの画像を追加しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+

|
2
|
+

|
3
|
+
|
1
4
|
下記のサイトを参考にチェックボックスをカスタムしているのですが、:checkedの反応がうまくいきません。
|
2
5
|
http://takeshishomepage.com/blog/2018/05/14/css%E3%81%A7checkbox%E3%82%92%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%9E%E3%82%A4%E3%82%BA%E3%81%99%E3%82%8B%E6%96%B9%E6%B3%95/
|
3
6
|
|