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

回答編集履歴

1

追記修正

2019/02/04 10:59

投稿

CHERRY
CHERRY

スコア25234

answer CHANGED
@@ -15,12 +15,20 @@
15
15
  ```
16
16
  <tr>
17
17
   <td class="titlebox">タイトル [必須]</td>
18
-  <td class="answerbox">[date* date-753 class:calendar date-format:mm/dd/yy first-day:0 placeholder "例:2019/01/01 "] <i class="fa fa-calendar" aria-hidden="true"></i>
18
+  <td class="answerbox">[date* date-753 class:calendar date-format:mm/dd/yy first-day:0 placeholder "例:2019/01/01 "] <span onclick="myFunc()"><i class="fa fa-calendar" aria-hidden="true"></i></span>
19
19
  </td>
20
20
  </tr>
21
21
  ```
22
+ JavaScript は、適当な場所に記載
23
+ ```
24
+ <script>
25
+ function myFunc(){
26
+ documtnt.forms[0].<フィールド名>.focus();
27
+ }
28
+ </script>
29
+ ```
22
30
 
23
- のように Contact Form7 のショートコードの後にそのまま記載すれば入力欄の右側にアイコンが表示されるのではないでしょうか?
31
+ のように Contact Form7 のショートコードの後にそのまま記載すれば入力欄の右側にアイコンが表示されるので、あと、JavaScript を使って onclickで `focus()`すれば、よいのではないでしょうか?
24
32
 
25
33
  例:
26
34