私はこれを動作させることはできませんが、 "Single Choice"を選択すると "Single"という文字列が表示され、文字列 "Single"を非表示にします。オプションが 'Single Option'の場合に文字列を表示するには
しかし、どのオプションが選択されていても、理由はわかりません。
のjQuery:
$('.numberAnswerTxt', context).each(function() {
var $this = $(this);
var $noofanswersText = '';
if ($questionType == 'Single Option') {
$noofanswersText = $("<span class='naRow string' style='display: inline-block;'>Single</span><input type='text' class='numberAnswerTxtRow answertxt' style='display: none;'>")
.attr('name', $this.attr('name'))
.attr('value', $this.val())
} else {
$noofanswersText = $("<span class='naRow string' style='display: none;'>Single</span><input type='text' class='numberAnswerTxtRow answertxt' style='display: inline-block;'>")
.attr('name', $this.attr('name'))
.attr('value', $this.val())
}
$noofanswers.append($noofanswersText);
});
のCss:
.numberAnswerTxtRow{
float:center;
width:40px;
font-size:14px;
font-weight:bold;
display:none;
}
.naRow{
float:center;
display:none;
}
あなたのコードを表示したいものに制御を持っている方法のようなものを使用することをお勧め:我々はいくつかの動的に作成された要素に '()' ATTRを適用することはできません... –