出于某种原因,在更改了我的代码之后:
<script type="text/javascript">
$(document).ready(function(){
$("recipebutton1").click(function(){
$('#create_form_span').css('display', 'none');
$("#recipe_display").replaceWith($('recipepopup1').css('display','block'));
});
$("#recipebutton2").click(function(){
$('#create_form_span').css('display', 'none');
$("#recipe_display").replaceWith($('#recipepopup2').css('display','block'));
});
$("#recipebutton3").click(function(){
$('#create_form_span').css('display', 'none');
$("#recipe_display").replaceWith($('#recipepopup3').css('display','block'));
});
$("#recipebutton4").click(function(){
$('#create_form_span').css('display', 'none');
$("#recipe_display").replaceWith($('#recipepopup4').css('display','block'));
});
$("#recipebutton5").click(function(){
$('#create_form_span').css('display', 'none');
$("#recipe_display").replaceWith($('#recipepopup5').css('display','block'));
});
$("#recipebutton6").click(function(){
$('#create_form_span').css('display', 'none');
$("#recipe_display").replaceWith($('#recipepopup6').css('display','block'));
});
$(".create").click(function(){
$('.recipepopup').css('display', 'none');
$('#create_form_span').css('display', 'block');
});
});
</script>
对此:
<script type="text/javascript">
$(document).ready(function(){
$("#recipebutton1").click(function(){
$('#create_form_span').css('display', 'none');
$(".recipepopup").css('display','none');
$("#recipe_display").empty();
$('#recipepopup1').clone().attr('id','clone1').css('display','block').appendTo('#recipe_display'); // append to where you want
});
$("#recipebutton2").click(function(){
$('#create_form_span').css('display', 'none');
$(".recipepopup").css('display','none');
$("#recipe_display").empty();
$('#recipepopup2').clone().attr('id','clone2').css('display','block').appendTo('#recipe_display'); // append to where you want
});
$("#recipebutton3").click(function(){
$('#create_form_span').css('display', 'none');
$(".recipepopup").css('display','none');
$("#recipe_display").empty();
$('#recipepopup3').clone().attr('id','clone3').css('display','block').appendTo('#recipe_display'); // append to where you want
});
$("#recipebutton4").click(function(){
$('#create_form_span').css('display', 'none');
$(".recipepopup").css('display','none');
$("#recipe_display").empty();
$('#recipepopup4').clone().attr('id','clone4').css('display','block').appendTo('#recipe_display'); // append to where you want
});
$("#recipebutton5").click(function(){
$('#create_form_span').css('display', 'none');
$("#recipe_display").empty();
$('#recipepopup5').clone().attr('id','clone5').css('display','block').appendTo('#recipe_display'); // append to where you want
});
$("#recipebutton6").click(function(){
$('#create_form_span').css('display', 'none');
$(".recipepopup").css('display','none');
$("#recipe_display").empty();
$('#recipepopup6').clone().attr('id','clone6').css('display','block').appendTo('#recipe_display'); // append to where you want
});
$(".create").click(function(){
$("#recipe_display").empty();
$('#create_form_span').css('display', 'block');
});
});
</script>
已经成功了,所以我的表单现在只是不断地在当前表单下加载一个新表单
谁能想到为什么会发生这样的事情?它把我逼疯了!
凯蒂