Не работает в Mozilla firefox и отлично работает в chrome $ ('input [data-type = "choise"]'). Change (function ()

Я работаю с онлайн-тестовым порталом, разрабатывая его отлично работающий с хром, но проблема в том, что он не работает с mozill.My код выглядит следующим образом, и он отлично работает в Chrome и не работает в firefox Mozilla. Предложите мне альтернативу или решение.

input [data-type = "choise"] не работает

        <script>
( document ).ready(function() {
                                $('input[data-type="choise"]').change(function() {
              var Question = $(this).attr('name');
              var Checked = $(this).attr('value');
                 y++;
              if(Checked=="0"){

              }else{
                  x++;


              }
              $('#score').replaceWith("<span id='score'><input type='hidden' name='score' id='score' value='"+ x +"' /> <input type='hidden' name='totalquestions' id='totalquestions' value='"+ y +"' /></span>");
                alert('Selected Choise for ' + Question + ' is ' + Checked+ 'and score is'+ x);

            });
            });
            </script>

        <div class="time">
        <label> Remaining Time </label> <span id="timer"></span>
        </div>
        <?php 
         include('connection.php');
        $test=$_SESSION["testnum"];
        $query=mysql_query("select * from questions where Testno='$test' order by Id ASC"); 
        if($query==true){  ?>
        <form id="scoretarget" name="formsubmit" action="congrasulations.php" method="POST">
        <span id="score"><input type="hidden" name="score" id="score" value="" />
        <input type='hidden' name='totalquestions' id='totalquestions' value="" />
        </span>
        <hr class="hr">
        <?php $id=1;
        While($row=mysql_fetch_array($query)){ ?>
            <?php 
            $questionnum=$row['Questionno'];
            $question=$row['Question'];
            $ans=$row['Answer'];
            ?>
             <div class="question">
            <div class="row">
            <div class="col-md-1">

            <label class="control-label form-inline">
            <?php echo $questionnum?>
            </label>
            </div>
            <div class="col-md-11 quest-left">
            <div class="form-group">
            <label class="control-label form-inline">
            <?php echo $question;?>
            </label>

            </div>
            <fieldset>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option A"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option1'];?></span><br>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option B"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option2'];?></span><br>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option C"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option3'];?></span><br>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option D"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option4'];?></span><br>
             </fieldset>
          </div>

          </div>
            </div><br>
          <?php ++$id;} ?>


          <input type="submit" name="proceed" value="proceed" class="btn btn-info pull-right">


          </form>

        <?php  } else{?>

        <div class="question">
            <div class="row">

        <div class="col-md-12">
        <h4 style="text-align:center; color:red;"> Question Paper is not updated  </h4>
        </div></div></div>
        <?php }

        ?>
              </div>

javascript,php,jquery,

1

Ответов: 2


0

У вас есть тип данных как выбор, где он должен быть выбран. Дух орфографическая ошибка.


0
<script>
( document ).ready(function() {
                                $('input[data-type="choise"]').click(function() {
              var Question = $(this).attr('name');
              var Checked = $(this).attr('value');
                 y++;
              if(Checked=="0"){

              }else{
                  x++;


              }
              $('#score').replaceWith("<span id='score'><input type='hidden' name='score' id='score' value='"+ x +"' /> <input type='hidden' name='totalquestions' id='totalquestions' value='"+ y +"' /></span>");
                alert('Selected Choise for ' + Question + ' is ' + Checked+ 'and score is'+ x);

            });
            });
            </script>

        <div class="time">
        <label> Remaining Time </label> <span id="timer"></span>
        </div>
        <?php 
         include('connection.php');
        $test=$_SESSION["testnum"];
        $query=mysql_query("select * from questions where Testno='$test' order by Id ASC"); 
        if($query==true){  ?>
        <form id="scoretarget" name="formsubmit" action="congrasulations.php" method="POST">
        <span id="score"><input type="hidden" name="score" id="score" value="" />
        <input type='hidden' name='totalquestions' id='totalquestions' value="" />
        </span>
        <hr class="hr">
        <?php $id=1;
        While($row=mysql_fetch_array($query)){ ?>
            <?php 
            $questionnum=$row['Questionno'];
            $question=$row['Question'];
            $ans=$row['Answer'];
            ?>
             <div class="question">
            <div class="row">
            <div class="col-md-1">

            <label class="control-label form-inline">
            <?php echo $questionnum?>
            </label>
            </div>
            <div class="col-md-11 quest-left">
            <div class="form-group">
            <label class="control-label form-inline">
            <?php echo $question;?>
            </label>

            </div>
            <fieldset>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option A"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option1'];?></span><br>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option B"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option2'];?></span><br>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option C"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option3'];?></span><br>
         <input type="radio" data-type="choise" name="q<?php echo $id; ?>" value="<?php if($ans=="Option D"){ echo"1";}else{echo"0";} ?>"><span> <?php echo $row['Option4'];?></span><br>
             </fieldset>
          </div>

          </div>
            </div><br>
          <?php ++$id;} ?>


          <input type="submit" name="proceed" value="proceed" class="btn btn-info pull-right">


          </form>

        <?php  } else{?>

        <div class="question">
            <div class="row">

        <div class="col-md-12">
        <h4 style="text-align:center; color:red;"> Question Paper is not updated  </h4>
        </div></div></div>
        <?php }

        ?>
              </div>
JavaScript, PHP, JQuery,
Похожие вопросы
Яндекс.Метрика