我正在使用jquery步骤向用户展示表单,但是我遇到了一个内容属性的奇怪问题。
如果我在一行代码上同时使用了两个" ",那么这些步骤就可以工作。
但是,如果通过添加另一个输入字段将关闭的"移动到另一行,则不会呈现这些步骤。
$("#wizard").steps({
headerTag: "h3",
bodyTag: "fieldset",
transitionEffect: "slideLeft",
onStepChanging: function(event, currentIndex, newIndex) {
//only apply to first step
if (currentIndex === 0 && ($("#workType > option:selected").val()) === "1") {
$("#wizard").steps("insert", 1, {
title: "Construction Details",
content: "<input type='text' name='budget' id='budget' placeholder='What is your budget?'><br/>"
});
}
});因此,这是可行的:
content: "<input type='text' name='budget' id='budget' placeholder='What is your budget?'><br/>"这并不意味着:
content: "<input type='text' name='budget' id='budget' placeholder='What is your budget?'>
<input type='text' name='timeline' id='timeline' placeholder='When do you want to start?'>
<br/>"内容是否需要放在一条线上,还是我做错了什么?提亚
发布于 2014-07-10 05:33:33
您可以尝试使用+连接字符串,例如:
content: "<input type='text' name='budget' id='budget' placeholder='What is your budget?'>" +
"<input type='text' name='timeline' id='timeline' placeholder='When do you want to start?'> +
"<br/>";或者另一种方式:
var content_str = [
'<input type='text' name='budget' id='budget' placeholder='What is your budget?'>',
'<input type='text' name='timeline' id='timeline' placeholder='When do you want to start?'>',
'<br />'
].join('');
...
contnet: content_strhttps://stackoverflow.com/questions/24668767
复制相似问题