【问题标题】:Jquery Filter Out Radio Buttons ( .not( ) )Jquery 过滤掉单选按钮 (.not())
【发布时间】:2015-09-03 10:52:52
【问题描述】:

我想从我的多项选择测验中删除单选按钮,以便用户查看他们的答案。我将所有要审核的问题放在一个名为 reviewQuestions

的 div 中
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>";

【问题讨论】:

    标签: php jquery filter


    【解决方案1】:

    使用find() 来获取直接/嵌套

    var someVariable = $(question).find('*').not("input[type=radio]").html();
    

    【讨论】:

      猜你喜欢
      • 2012-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-22
      • 2021-12-11
      • 2015-12-31
      • 1970-01-01
      • 2020-08-30
      相关资源
      最近更新 更多