質問編集履歴

1

HTMLコードの修正、Javascriptのコードの追加

2018/02/11 23:39

投稿

rumi
rumi

スコア46

test CHANGED
File without changes
test CHANGED
@@ -1,13 +1,67 @@
1
- 現状、投稿するボタンが2回押せてしまうので、```onclick="disabled = true;"```を記載しましたが、まだ2回押せてしまいます。原因がお分かりの方はご教示いただけると幸いです。
1
+ 現状、投稿するボタンが2回押せてしまうので、```onclick="this.disabled = true;"```を記載しましたが、まだ2回押せてしまいます。原因がお分かりの方はご教示いただけると幸いです。
2
2
 
3
3
 
4
4
 
5
- ```ここに言語を入力
6
5
 
7
- <button type="button" class="btn" onclick="disabled = true;">
8
6
 
7
+ (コードを修正)
8
+
9
+ ```HTML
10
+
11
+ <button type="button" class="btn" data-ele="finish" onclick="this.disabled = true;">
12
+
9
- 投稿する
13
+ 投稿する
10
14
 
11
15
  </button>
12
16
 
13
17
  ```
18
+
19
+
20
+
21
+
22
+
23
+ (追加)
24
+
25
+ ```JS
26
+
27
+
28
+
29
+ $(document).on('click', '[data-ele="finish"]', function(e) {
30
+
31
+ if ($('#postProjectForm').isValid()) {
32
+
33
+ var activeUploads = $('#fileupload').fileupload('active');
34
+
35
+ if (activeUploads > 0) {
36
+
37
+ toastr["error"]("Uploads are still in progress. Please wait a little more, enjoy a sip of coffee instead.");
38
+
39
+ } else {
40
+
41
+ submitFormHandlerWithUpload(window.location.href, 'postProjectForm', 'Please wait..',function(data){
42
+
43
+ if(typeof data.redirect != "undefined" || data.redirect != ""){
44
+
45
+ setTimeout(function(){
46
+
47
+ window.location.href = data.redirect;
48
+
49
+ },500);
50
+
51
+ }
52
+
53
+ });
54
+
55
+ }
56
+
57
+
58
+
59
+ }
60
+
61
+
62
+
63
+ });
64
+
65
+
66
+
67
+ ```