我有一个显示表单的 JQuery UI 对话框弹出窗口。通过单击添加更多按钮,我可以将新表单添加到 JQuery UI 对话框中。
单击添加新按钮时,如何使 JQuery UI 对话框自动滚动并向用户显示新的空白表单。
添加了分区
<div>
<form id="1">
<label class="dbright">DashBoard ID:</label><span class="dbleft"><select id="dashboard_id" class="dbSettingDD"><option>-------Select-------</option><option id="#dashboard">Inventory</option><option id="#dashboard2">Quality</option><option id="#dashboard3">Complaints</option></select><br></span>
<label class="dbright">Filtering parameter:</label><span class="dbleft"><select id="filter_by"><option>-------Select-------</option></select><br></span>
<label class="dbright">Y-Axis:</label><span class="dbleft"><select id="yAxis"><option>-------Select-------</option></select><br></span>
<label class="dbright">Chart Tiltle:</label><span class="dbleft"><input type="text" id="title"><br></span>
<label class="dbright">Chart Type:</label><span class="dbleft"><input type="text" id="chart_type"><br></span>
<label class="dbright">Main Chart:</label><span class="dbleft"><input type="radio" name="mainchart" value="yes">Yes <input type="radio" name="mainchart" value="No">No<br></span>
</form>
</div>
对话
$("#dbSetting_div").dialog({
height: 315,
width: 500,
autoOpen: false,
modal: true,
draggable: false,
buttons: {
"Save": function () {},
"Add More": function () {
l_i++;
formHtml = "<div>";
formHtml += "<form id='" + l_i + "'>";
formHtml += "<label class = 'dbright'>DashBoard ID: </label><span class = 'dbleft'><select id='dashboard_id' class='dbSettingDD'><option>-------Select-------</option>" + dropDownDashboardName + "</select></br></span>";
formHtml += "<label class = 'dbright'>Filtering parameter: </label><span class = 'dbleft'><select id='filter_by'><option>-------Select-------</option></select></br></span>";
formHtml += "<label class = 'dbright'>Y-Axis: </label><span class = 'dbleft'><select id='yAxis'><option>-------Select-------</option></select></br></span>";
formHtml += "<label class = 'dbright'>Chart Tiltle: </label><span class = 'dbleft'><input type='text' id='title'/></br></span>";
formHtml += "<label class = 'dbright'>Chart Type: </label><span class = 'dbleft'><input type='text' id='chart_type'/></br></span>";
formHtml += "<label class = 'dbright'>Main Chart: </label><span class = 'dbleft'><input type='radio' name='mainchart' value='yes'/>Yes <input type='radio' name='mainchart' value='No'/>No</br></span>";
formHtml += "</form>";
formHtml += "</div>";
$("#dbSetting_div").append("<p>" + formHtml + "</p>");
console.log(scroll);
}
}
}).css("font-size", "12px");