2013-11-28 1 views
0

colorbox에서 어떻게 응답 (예 : 제출 단추)을받을 수 있습니까?인라인 호출이있는 HTML 외부의 jQuery colorbox

index.html을

<input type="text" id="test"> 
<input type="submit" id="btn"> 

내가 제출 버튼을 클릭

$(document).ready(function(){ 

    $(".myclass").colorbox({width:"75%", height:"75%"}); 

    $('#btn').click(function(){ 
     $("#test").val("it works!"); 
    }); 
}); 

<body> 
    <a class='myclass' href="1.html">Click to show the Colorbox</a> 
</body> 

1.html

아무 일도 발생하지 않습니다. colorbox의 내용을 호출하고 내용을 변경하려면 어떻게해야합니까?

답변

0
은 다음과 같이 코드를 변경

:

 $(document).ready(function() { 
      $(".myclass").colorbox({ 
       width: "75%", 
       height: "75%", 
       onComplete: function() { 
       $('#btn').click(function() { 
        $("#test").val("it works!"); 
       }); 
       } 
      });   
     }); 
+0

감사 매튜는 ... 좋아요 :)를 작동 – user3046431

관련 문제