2012-06-27 76 views
0

Fancybox在我的DOM底部附加它的DIV标记。有没有办法让它在FORM标签中追加?我将它绑定到表单标签中的一个元素,但是当我在Chrome中检查文档时,Fancybox DIV被添加到底部。将Fancybox DIV添加到表单标记

原因是我使用MVC3并在fancybox中加载局部视图。这部分工作。由于它们在FORM之外,fancybox中的字段在回发时被模型绑定器排除。

我在做什么错?

<script type='text/javascript'>//<![CDATA[ 
    $(window).load(function(){ 
    $(document).ready(function() { 
     $(".clickMe").fancybox({ 
     content: $('#test') 
     }); 
    }); 
    });//]]> 
</script> 


<body> 
    <form id='testform'> 
    <a href="#emailViewFancybox" class="clickMe">Click Me</a> 
    </form> 
    <div style="display: none;" id='test'> 
    Tri-tip brisket ribeye fatback ground round pork chop. Strip steak tenderloin t-bone tri-tip, spare ribs tongue prosciutto meatloaf. Beef ribs ham sirloin, biltong ham hock venison jowl andouille flank pork belly. Meatball strip steak chicken, capicola prosciutto hamburger spare ribs. 
    </div>  
</body> 

回答

1

我有类似的问题,作为窗体的一部分的JQuery对话框。我最终不得不使用JavaScript将生成的div移动到生成的表单中。

+0

谢谢。我用jquery的.appendTo()来移动窗体内我需要的div,它工作。 –