我的 html
<ul id="sortable" class="ui-sortable">
<li class="instruction_step" id="slid_1">
<p class="sort">1</p>
<div contenteditable="true" class="description">Some step</div>
<div class="step_image" id="img_1" style="background: url(/templates/1.jpg) 0 0 no-repeat; background-size: 300px;"></div>
</li>
<li class="instruction_step" id="slid_2">
<p class="sort">2</p>
<div contenteditable="true" class="description">another step</div>
<div class="step_image" id="img_2" style="background: url(/templates/2.jpg) 0 0 no-repeat; background-size: 300px;"></div>
</li>
<li class="instruction_step" id="slid_3">
<p class="sort">3</p>
<div contenteditable="true" class="description">some another step</div>
<div class="step_image" id="img_3" style="background: url(/templates/3.jpg) 0 0 no-repeat; background-size: 300px;"></div>
</li>
</ul>
我的js
$("#sortable").on("dblclick", "li", function (event) {
$("#sortable li.editing").each(function (index) {
$(this).removeClass('editing');
$(this).find(".step_image").removeClass('dz-clickable');
});
$(this).addClass('editing');
var img_id = $(this).find(".step_image").attr('id');
var myDropzone = new Dropzone("#" + img_id + "", {
url: "/upload/url?" + img_id,
previewsContainer: "#previews",
clickable: "#" + img_id + ""
});
$(this).find(".description").focus();
});
我有 jqueryui 可排序的,当我 dblclick 它时,我可以在里面编辑数据,我可以在 contenteditable div 中写入文本并上传图片(使用 DROPZONE.JS),但是上传图片时会出现问题,我想要更多 myDropzone,因为它会创建更多这个,所以在创建新的之前我想删除它