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

質問編集履歴

2

追記

2020/09/17 03:20

投稿

heypo
heypo

スコア3

title CHANGED
File without changes
body CHANGED
@@ -50,4 +50,38 @@
50
50
  }
51
51
  ```
52
52
 
53
- よろしくお願いします。
53
+ よろしくお願いします。
54
+
55
+
56
+
57
+
58
+
59
+ # 追記
60
+
61
+ このような形で書いて実現できました。
62
+
63
+ ```HTML
64
+ <input type="text" id="textForm">
65
+ <label for="textForm">坪</label>
66
+ <button id="cluc" class="btn btn-outline-primary">変換</button>
67
+
68
+ <input type="text" id="resultForm">
69
+ <label for="resultForm">㎡</label>
70
+ ```
71
+
72
+
73
+ ```js
74
+ <script>
75
+ var button = document.getElementById("cluc");
76
+ button.addEventListener("click", function(e) {
77
+
78
+ e.preventDefault();
79
+
80
+ var textForm = document.getElementById("textForm").value;
81
+
82
+ var resultForm = document.getElementById("resultForm");
83
+ // resultForm.value = textForm * 3.30578;
84
+ resultForm.value = Math.round(textForm * 3.30578512396 * 100) / 100;
85
+ });
86
+ </script>
87
+ ```

1

誤字

2020/09/17 03:20

投稿

heypo
heypo

スコア3

title CHANGED
@@ -1,1 +1,1 @@
1
- JQueryで計算をしたいのですが、できません。
1
+ JavaScriptで計算をしたいのですが、できません。
body CHANGED
@@ -28,10 +28,6 @@
28
28
  }
29
29
  ```
30
30
 
31
- jQueryの読み込み部分
32
- ```HTML
33
- <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
34
- ```
35
31
 
36
32
  ↓エラー画面
37
33
  ```HTML