这是我正在研究的小提琴 http://jsfiddle.net/d0okie0612/22cTn/
我试图让框出现在按钮的顶部,但在现有的 div 框的底部。
<div id="top_form">
<form>
Street: <input name="titles[]" type="text" placeholder="eg: 123 Fake st."><br><br>
City: <input name="titles[]" type="text" placeholder="eg: Bellflower">
<select>
<option value=" ">State</option>
<option value="ca">CA</option>
<option value="az">AZ</option>
<option value="de">DE</option>
</select>
Zip: <input name="titles[]" type="text" placeholder="eg: 91745"><br />
</form>
</div>
<br />
<a id="awsomeButton" href="#">+ Add Loction</a>
这是脚本
var tpl = ""
+ "<div id='location_div_<%= id %>'><h1>My Location #<%= id %></h1></div>";
var newId = new Date().getTime();
var template = _.template(tpl);
var compiled = template({id: newId});
var form = ""
+ "<div id='added_form'><a href='#' class='close_btn'>x</a><form> Street: <input name='titles' type='text'><br /><br />City: <input name='titles' type='text'><select><option value=' '>State</option><option value='ca'>CA</option></select>Zip: <input name='titles' type='text'></form></div>"
$('#awsomeButton').on('click',
function(e){
$(form).hide().appendTo('body').fadeIn('slow');
});