我想从多项选择测验中删除radiobuttons,以便用户可以查看他们的答案。我将所有问题都放在一个名为reviewQuestions
var question = '#question' + zz; // zz is a variable that produces a number
var someVariable = $(question).not("input[type=radio]").html(); //this is the line that doesn't work
$('#reviewQuestions').append(someVariable);
生成测验的php:
echo "<div id='question" . $question_number . "' class='quest'>";
echo "<div class='questionItself'>" . $qn . ". " . $question . "</div>";
echo "<div class='answerContainer'>";
echo "<input type='radio' name='qr".$question_number."' value='a'> A. " . $chA . "<br><br>";
echo "<input type='radio' name='qr".$question_number."' value='b'> B. " . $chB . "<br><br>";
echo "<input type='radio' name='qr".$question_number."' value='c'> C. " . $chC . "<br><br>";
echo "<input type='radio' name='qr".$question_number."' value='d'> D. " . $chD . "<br><br>";
echo "<input type='radio' name='qr".$question_number."' value='e'> E. " . $chE . "<br>";
答案 0 :(得分:1)
使用find()抓取直接/嵌套儿童
var someVariable = $(question).find('*').not("input[type=radio]").html();