質問編集履歴

5

訂正

2018/03/09 00:13

投稿

MeB
MeB

スコア104

test CHANGED
File without changes
test CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
 
18
18
 
19
-
19
+ 現在動いているコード(type="submit"をtype="button"にすると動かない)
20
20
 
21
21
  ```js
22
22
 
@@ -24,9 +24,9 @@
24
24
 
25
25
  <script src="js/jquery.validate.min.js"></script>
26
26
 
27
- <script type="text/javascript">
27
+ <script type="text/javascript">
28
28
 
29
- $(function() {
29
+ $(function() {
30
30
 
31
31
  $("#form").validate({
32
32
 
@@ -44,21 +44,21 @@
44
44
 
45
45
  });
46
46
 
47
- </script>
47
+ </script>
48
48
 
49
49
  ```
50
50
 
51
51
  ```html
52
52
 
53
- <form id="form" action="" method="post" name="form">
53
+ <form id="form" action="index.php" method="post" name="form">
54
54
 
55
- <p>会社名<span>(必須)</span></p>
55
+ <p>名</p>
56
56
 
57
- <input type="text" name="name" value="" class="">
57
+ <input type="text" name="name"/>
58
58
 
59
- <div class="submit"><button type="button" name="mode" value="confirm" id="btn_id"><img src="images/check.png" alt="送信"><span>確認画面</span></button></div>
59
+ <button type="submit"><img src="images/check.png" alt="送信"><span>確認画面</span></button>
60
60
 
61
- </form>
61
+ </form>
62
62
 
63
63
  ```
64
64
 

4

追記

2018/03/09 00:12

投稿

MeB
MeB

スコア104

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,5 @@
1
+ [https://jqueryvalidation.org/](https://jqueryvalidation.org/)
2
+
1
3
  Validation Pluginを使ってみたのですが、
2
4
 
3
5
  全く反応してくれません。

3

訂正

2018/03/09 00:08

投稿

MeB
MeB

スコア104

test CHANGED
File without changes
test CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  rules : {
32
32
 
33
- corp_name: {
33
+ name: {
34
34
 
35
35
  required: true
36
36
 
@@ -50,9 +50,9 @@
50
50
 
51
51
  <form id="form" action="" method="post" name="form">
52
52
 
53
- <p>名<span>(必須)</span></p>
53
+ <p>会社名<span>(必須)</span></p>
54
54
 
55
- <input type="text" name="name" value="" class="">
55
+ <input type="text" name="name" value="" class="">
56
56
 
57
57
  <div class="submit"><button type="button" name="mode" value="confirm" id="btn_id"><img src="images/check.png" alt="送信"><span>確認画面</span></button></div>
58
58
 

2

訂正

2018/03/08 13:02

投稿

MeB
MeB

スコア104

test CHANGED
File without changes
test CHANGED
@@ -24,29 +24,23 @@
24
24
 
25
25
  <script type="text/javascript">
26
26
 
27
- $("form").validate({
27
+ $(function() {
28
28
 
29
- rules : {
29
+ $("#form").validate({
30
30
 
31
- corp_name: {
31
+ rules : {
32
32
 
33
+ corp_name: {
34
+
33
- required: true
35
+ required: true
36
+
37
+ }
34
38
 
35
39
  }
36
40
 
37
- },
41
+ });
38
42
 
39
- messages: {
40
-
41
- corp_name:{
42
-
43
- required: "必須項目です。"
44
-
45
- }
46
-
47
- }
48
-
49
- });
43
+ });
50
44
 
51
45
  </script>
52
46
 

1

追記

2018/03/08 13:01

投稿

MeB
MeB

スコア104

test CHANGED
File without changes
test CHANGED
@@ -65,3 +65,15 @@
65
65
  </form>
66
66
 
67
67
  ```
68
+
69
+
70
+
71
+ 追記
72
+
73
+ type="button"
74
+
75
+ を削除すると動くのですが、type="button"
76
+
77
+ を使えるようにする方法はありますでしょうか。
78
+
79
+ 他の処理もあるためtype="submit"は使えません。