我想有一些问题如何动态控制手风琴。
当单击添加按钮时,我应该再添加一行子手风琴,然后单击删除按钮将删除手风琴的最后一行。
然后我有一个问题如何控制它。
我的源代码如下。
JS:
$("#addResolution").click(function (e) {
alert("Add new resolution. ");
});
$("#removeResolution").click(function (e) {
alert("Remove new resolution. ");
});
<h3><a href="#" class="editor-label">
@Html.LabelFor(model => model.Resolution)
</a></h3>
<div>
<button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-all" id="addResolution">
<span class="ui-button-text">ADD</span>
</button>
<button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-all" id="removeResolution">
<span class="ui-button-text">DEL</span>
</button>
<div id="accordionSub">
<h3><a href="#" class="editor-label">
@Html.LabelFor(model => model.Resolution)
</a></h3>
<div class="editor-field">
@Html.EditorFor(model => model.Resolution,
new
{
style = "width:" + 100 + "%; height:" + 5 + "em;"
})
@Html.ValidationMessageFor(model => model.Resolution)
<br />
<label id="lblFileUploadResolution">Choose Image File</label>
<input type="file" name="uploadFile" id="fileToUploadResolution" style="width:89%;" accept="image/png, image/gif, image/jpeg, image/bmp" />
<input type="button" id="btnFileUploadResolution" value="Upload" style="width:10%;" />
</div>
</div>
</div>
当我单击添加按钮时,动态添加一列并增加手风琴子 ID(例如:accordian1、accordian2、accordian3)
并单击删除按钮,然后删除最后一行。
请帮帮我谢谢!