【发布时间】:2018-10-19 17:59:55
【问题描述】:
我正在使用 Bootstrap 游览,但问题是我只需要游览/突出显示不正确的字段。 Bootstrap tour 的问题在于硬编码所有元素的 id 或类名。我的表单错误是基于不正确的字段。所以我无法对字段 ID 进行硬编码,因为在用户填写表单之前我不知道哪些字段不正确。
// Instance the tour
var tour = new Tour({
backdrop: true,
steps: [
{
element: "#primary-address-line-label-2",
title: "Title of my step",
content: `<h3 class="tool-tip-title">Review/Update Your Address</h3>
<div class="tip-content">
<p>Our records indicate the address we have on file for you may be incorrect.</p>
<p>Please make any edits in the field below. Click "Save & Continue" once you are finished.</p>
</div>
<div class="number-of-actions">1 of 5 Actions</div>`,
placement: "top"
}
]});
// Initialize the tour
tour.init();
// Start the tour
tour.start();
我的html是:
<div>
<label>City</label>
<input class="form-control" type="text" id="City" class="error"><span style="display: inline-block;">City is required.</span>
</div>
<div>
<label>City</label>
<input class="form-control" type="text" id="State" class="error"><span style="display: inline-block;">State is required.</span>
</div>
从我的示例中可以看出,城市和州字段具有错误类并且不正确,但根据用户输入,任何字段都可能不正确。
Bootstrap tour 是否能够根据不正确的字段创建动态元素/步骤?
是否有任何其他使用工具提示验证字段的 jQuery 或 JavaScript 插件?
Bootstrap Tour 位于here
【问题讨论】:
标签: javascript jquery jquery-plugins bootstrap-tour