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

回答編集履歴

1

ソース修正

2020/01/27 08:17

投稿

yureighost
yureighost

スコア2183

answer CHANGED
@@ -1,9 +1,22 @@
1
1
  他の方の回答も取り入れて修正してみましたが、
2
2
  先に断っておくとこの修正は追加、削除ともどのボタンを押しても末尾が変更されます。
3
3
  中間の要素を変更すると難易度が跳ね上がるからです。
4
- 統合版のscriptとbody部分に修正を入れています。
4
+ ~~統合版のscriptとbody部分に修正を入れています。~~
5
+ HTMLの全ソースを貼っておきます。
5
6
  ```HTML
7
+ <!doctype html>
8
+ <html lang="ja">
6
- ・・・
9
+ <head>
10
+ <meta charset="utf-8">
11
+ <title></title>
12
+
13
+ <!--tagit-->
14
+ <script src="https://code.jquery.com/jquery-1.9.1.js"></script>
15
+ <link rel="stylesheet" type="text/css" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/flick/jquery-ui.css">
16
+ <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
17
+ <link rel="stylesheet" type="text/css" href="tagit/css/jquery.tagit.css">
18
+ <script type="text/javascript" src="tagit/js/tag-it.min.js"></script>
19
+
7
20
  <script type="text/javascript">
8
21
  var template;
9
22
  var addKarikamokuTagit = function(idx) {
@@ -46,7 +59,43 @@
46
59
  }
47
60
  });
48
61
  </script>
62
+
63
+ <style type="text/css">
64
+ <!--
65
+ #input_plural {
66
+ margin: 10px 0;
67
+ }
68
+
69
+ #input_plural input.form-control1 {
70
+ display: inline-block;
71
+ width: 40%;
72
+ height: 34px;
73
+ padding: 6px 12px;
74
+ font-size: 14px;
75
+ color: #555;
76
+ }
77
+
78
+ #input_plural input.form-control2 {
79
+ display: inline-block;
80
+ width: 40%;
81
+ height: 34px;
82
+ padding: 6px 12px;
83
+ font-size: 14px;
84
+ color: #555;
85
+ }
86
+
87
+ #input_plural input.pluralBtn {
88
+ width: 30px;
89
+ height: 30px;
90
+ border: 1px solid #ccc;
91
+ background: #fff;
92
+ border-radius: 5px;
93
+ padding: 0;
94
+ margin: 0;
95
+ }
49
- ・・・
96
+ -->
97
+ </style>
98
+ </head>
50
99
  <body>
51
100
  <form>
52
101
  <div id="input_pluralBox">
@@ -59,6 +108,7 @@
59
108
  </div>
60
109
  </form>
61
110
  </body>
111
+ </html>
62
112
  ```
63
113
  処理のおおまかな説明ですが、.tagit部分のfieldName:部分に設定する名前は一意でないといけません。
64
114
  不具合動作で報告されている下のテキストフィールドのタグを消すと上のが消えるのは、