2012-09-18 2 views
0

대화 상자 내에서 탭을 초기화하려고하지만 작동하지 않습니다. 대화 상자 html은 초기화에 의해 추가됩니다. 나는 원시 html을 다시 얻고있다. 제가 시도한 코드는 다음과 같습니다. 그러나 중단 점에 불을 지르고의 코드는대화 상자 내의 탭이 렌더링되지 않습니다.

//HTML 
<div id="tabs"> 
    <ul> 
     <li><a href="#tab-1">Edit</a> 
     </li> 
     <li><a href="#tab-2">Send Email</a> 
     </li> 
    </ul> 



    <div id="tab-1"> 

     <form action="#" method="post" id="edit_form"></form> 
    </div> 
    <div id="tab-2"> 
     <div id="contact-wrapper"> 
      <form method="post" action="mailer.php" id="contactform"></form> 
     </div> 

    </div> 

</div> 

를 작동하며 자바 스크립트 당신은 대화 상자를 열었습니다 후 탭을 초기화하기 위해 필요

// Init Dialog 
     $('a.open_dialog').click(function() { 
      $('#tabs').tabs(); 

      $('<div />').appendTo('body').load($(this).attr('href')).dialog({ 
       title: $(this).attr('title'), 
       modal: true, 
       draggable: false, 
       width: 800, 
       position: 'top', 
       buttons: { 
        "Save": function() { 
         $.ajax({ 
           type: "POST", 
           url: 'action.php', 
           data: $("#edit_form").serialize(), // serializes the form's elements. 
           success: function(data) 
           { 
            alert(data); // show response from the php script. 
           } 
          }); 

        }, 
        "Send Email": function() { 

         $.ajax({ 
           type: "POST", 
           url: 'mailer.php', 
           data: $("#contactform").serialize(), // serializes the form's elements. 
           success: function(data) 
           { 
            alert(data); // show response from the php script. 
           } 
          }); 
        } 
       }, 
       close: function() { 
        location.reload(true); 
        allFields.val("").removeClass("ui-state-error"); 


       } 
      }); 

답변

0

. 귀하의 코드는 내가 $ ('# 탭')에 불을 지르고 디버거에서 브레이크 포인트를 넣어 만하면 괜찮을 것 같지만 화재 .tabs()

+0

.dialog()

$('<div />').dialog({ open : function(){ //In case of autoOpen = true $('#tabs').tabs(); } }); 

하지 않으면, 당신은 전화를 순차적으로 호출 할 수 있습니다. 탭을(); – kakuki

+0

내 문제를 해결할 수있는 또 다른 팁이있을 수도 있습니다. – kakuki

관련 문제