質問するログイン新規登録

質問編集履歴

1

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

2018/02/11 23:39

投稿

rumi
rumi

スコア46

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