Mun*_*Mun 6 jquery drag-and-drop jquery-ui radio-button jquery-ui-sortable
我正在使用jQuery UI sortables插件来允许重新排序某些列表项.在每个列表项中,我有几个单选按钮,允许启用或禁用该项.
当拖动项目时,两个单选按钮都被取消选择,这似乎不应该发生.这是正确的行为,如果没有,解决这个问题的最佳方法是什么?
以下是演示此问题的代码示例:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>jQuery Sortables Problem</title>
<script src="jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="jquery-ui.min.js" type="text/javascript"></script>
<style type="text/css">
.items
{
margin-top: 30px;
margin-left: 0px;
padding-left: 25px;
cursor: move;
}
.items li
{
padding: 10px;
font-size: 15px;
border: 1px solid #666;
background: #eee;
width: 400px;
margin-bottom: 15px;
float: left;
clear:both;
}
</style>
</head>
<body>
<ol id="itemlist" class="items">
<li id="1" class="item">
Item 1
<input name="status_1" type="radio" value="1" checked="checked" />enabled
<input name="status_1" type="radio" value="0" />disabled
</li>
<li id="2" class="item">
Item 2
<input name="status_2" type="radio" value="1" checked="checked" />enabled
<input name="status_2" type="radio" value="0" />disabled
</li>
<li id="3" class="item">
Item 3
<input name="status_3" type="radio" value="1" checked="checked" />enabled
<input name="status_3" type="radio" value="0" />disabled
</li>
<li id="4" class="item">
Item 4
<input name="status_4" type="radio" value="1" checked="checked" />enabled
<input name="status_4" type="radio" value="0" />disabled
</li>
</ol>
<script type="text/javascript">
$('#itemlist').sortable();
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
只要用鼠标抓住列表项,就会取消选中这两个单选按钮.
如果这是一个错误,一个解决方法是在项目移动时自动选择"启用"单选按钮,因此任何关于如何实现这一点的建议也将是最受欢迎的.
更新:我在FireFox 3,Internet Explorer 7,Opera 9.5和Safari 3.1.2中测试了这一点,所有这些都在Windows XP x64上进行,所有这些问题都出现了.
这是在 Internet Explorer 中吗?众所周知,IE 在复制/移动时会丢失复选框和单选框的选择。
http://webbugtrack.blogspot.com/2007/11/bug-299-setattribute-checked-does-not.html
需要重置 defaultChecked 才能使 IE 正常工作
| 归档时间: |
|
| 查看次数: |
4374 次 |
| 最近记录: |