質問編集履歴
5
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -147,3 +147,27 @@
|
|
147
147
|
2:[object Object]
|
148
148
|
|
149
149
|
3:[object Object]
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
###試したこと3
|
154
|
+
|
155
|
+
試したこと2 の最後のeach部分を以下のように修正。
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
var result = $('#textarea').val();
$.each(output, function (key, object) {
$.each(object, function (title, text) {
if (result[title] !== '') {
result += (title + ':' + text + '\n');
}
})
});
$('#textarea').val(result);
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
・結果
|
164
|
+
|
165
|
+
title : text
|
166
|
+
|
167
|
+
title : text
|
168
|
+
|
169
|
+
title : text
|
170
|
+
|
171
|
+
title : text
|
172
|
+
|
173
|
+
期待した結果にはなったが、もっとスマートな方法はありますでしょうか。
|
4
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -89,3 +89,61 @@
|
|
89
89
|
length:0
selected:Array[0](未選択状態)
|
90
90
|
|
91
91
|
string:"てきすと"
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
###試したこと2
|
96
|
+
|
97
|
+
```
|
98
|
+
|
99
|
+
function output() {
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
// Textareaへの出力用配列
|
104
|
+
|
105
|
+
var output = [];
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
// radioButton のラベルタイトル
|
110
|
+
|
111
|
+
output.push({'radioButton' : radioButton.text()} );
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
// 複数選択selectboxで選択されている値(text)
|
116
|
+
|
117
|
+
var selectedText = [];
$selected = $Field_2.find('#selected option:selected');
$selected.each(function () {
selectedText.push($(this).text());
});
|
118
|
+
|
119
|
+
output.push({'selected' : selectedText});
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
// 普通のtext
|
124
|
+
|
125
|
+
output.push({'string' : string.text()});
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
// 出力箇所
|
130
|
+
|
131
|
+
$.each(output, function (key, text) {
$('#textarea').append(key + ' : ' + text + "\n");
});
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
```
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
・結果
|
140
|
+
|
141
|
+
出力はされているがキーが配列番号になってしまう。
|
142
|
+
|
143
|
+
0:[object Object]
|
144
|
+
|
145
|
+
1:[object Object]
|
146
|
+
|
147
|
+
2:[object Object]
|
148
|
+
|
149
|
+
3:[object Object]
|
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -71,3 +71,21 @@
|
|
71
71
|
###試したこと
|
72
72
|
|
73
73
|
Modal内の各要素を配列化することはできている。
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
[追記]
|
80
|
+
|
81
|
+
・each直前のoutputの中身
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
output: Array[0]
|
86
|
+
|
87
|
+
radioButtn:"らじお"
|
88
|
+
|
89
|
+
length:0
selected:Array[0](未選択状態)
|
90
|
+
|
91
|
+
string:"てきすと"
|
2
本文修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -15,6 +15,12 @@
|
|
15
15
|
・実現したいこと
|
16
16
|
|
17
17
|
Modalにて設定した項目・内容をTextareaに出力したい。
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
###わからないこと
|
22
|
+
|
23
|
+
出力処理のeachに入らず、出力されない
|
18
24
|
|
19
25
|
|
20
26
|
|
1
本文修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
|
5
5
|
POST送信用フォーム:Form
|
6
6
|
|
7
|
-
Form
|
7
|
+
Formの中にある「詳細フィールド(textarea)」:Textarea
|
8
8
|
|
9
|
-
Form
|
9
|
+
Formと同じ画面内にある別フォームModal:Modal
|
10
10
|
|
11
11
|
Modalの中身:ラジオボタン・text・セレクトリスト
|
12
12
|
|