我创建了一些div,现在我希望它们可以排序。我使用php for循环生成div。当我使用sortable时,只对ui元素或单选按钮进行排序,没有按预期发生。以下是我如何生成div
<?php $questionNo = 1; foreach($english as $eng) : ?>
<div class="hov" id="qblock" questionID="<?php echo $eng['id']; ?>" >
<span><?php echo $questionNo . '. '. $eng['question_desc']; ?></span> <br/>
<input type="radio" name="testyourselfques<?php echo $questionNo; ?>" value="<?php echo $eng['option1'];?>" /> <span class="options"><?php echo $eng['option1'];?></span><br/>
<input type="radio" name="testyourselfques<?php echo $questionNo; ?>" value="<?php echo $eng['option2'];?>" /> <span class="options"><?php echo $eng['option2'];?></span><br/>
<input type="radio" name="testyourselfques<?php echo $questionNo; ?>" value="<?php echo $eng['option3'];?>" /> <span class="options"><?php echo $eng['option3'];?></span><br/>
<input type="radio" name="testyourselfques<?php echo $questionNo; ?>" value="<?php echo $eng['option4'];?>" /> <span class="options"><?php echo $eng['option4'];?></span><br/>
<img id="q<?php echo $questionNo;?>wrong" src="<?php echo base_url();?>assets/images/verdict/wrong.png" height="40" width="40" style="display:none;"><img id="q<?php echo $questionNo;?>correct" src="<?php echo base_url();?>assets/images/verdict/correct.png" height="40" width="40" style="display:none;"><img id="q<?php echo $questionNo;?>unattempted" src="<?php echo base_url();?>assets/images/verdict/unattempted.png" height="40" width="40" style="display:none;"><br/>
<span id="correctans<?php echo $questionNo;?>" style="font-size:17px;display:none;">Correct ans. : <?php echo $eng['answer'];?></span>
<input type="hidden" id="rightanswer<?php echo $questionNo; ?>" value="<?php echo $eng['answer'];?>" />
</div>
<br/><br/>
<?php $questionNo++; ?>
<?php endforeach; ?>
为了使那些可排序的我使用以下代码..但它不起作用......
$("div#qblock").sortable();
如何解决这个问题????????????