使用類而不是使用Id進行對話框初始化。而且你不能有(如果有的話)相同的ID的多個元素
演示:http://jsfiddle.net/lotusgodkk/GCu2D/58/
代碼:
<div class="checked" >Click to open dialog</div>
<div class="checked" >Click to open dialog</div>
<div class="checked" >Click to open dialog</div>
<div class="checked" >Click to open dialog</div>
<div class="checked" >Click to open dialog</div>
<div class="checked" >Click to open dialog</div>
<div class="checked" >Click to open dialog</div>
<div class="checked" >Click to open dialog</div>
的Javascript:
$(document).ready(function() {
for (var i = 0; i < 7; i++) {
$(".checked").dialog({
resizable: true,
width: "auto",
modal: true,
title: "test"
});
}
});
你錯過了在右括號for循環 –