2017-05-23 2 views
0

페이지를로드 할 때 텍스트 상자에있는 코드가 자동으로로드됩니다.로드 된 DOM 컨텐츠를 사용하고있을 가능성이 있습니까? 어떤 제안?실시간 편집기

<!--- Shows the Code that Is inserted into the Text Box -->    

<div id="DisplayCode"></div> 

<!--- End Of Shows the Code that Is inserted into the Text Box --> 





<!-- Text Box Code Where You input the Code --> 
     <div class="form1"> 
     <textarea id="Code" value="insert Code Here" rows="14" cols="183" ><!DOCTYPE html> 
     <html> 
     <body> 

     <h1> Insert Your Code Here </h1> 

     </body> 
     </html> 
      </textarea> 

    <!-- End of Text Box Where You Enter your Code --> 





    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script> 
    <script> 
    $(document).ready(function(){ 
     $('#Code').keyup(function(){ 
      $('#DisplayCode').html($(this).val()); 
     }); 
    }); 
    </script> 

    </div> 

답변

0
$(document).ready(function(){ 
    $('#DisplayCode').html($("#Code").val()); 
    $('#Code').keyup(function(){ 
     $('#DisplayCode').html($(this).val()); 
    }); 
}); 

간단히 그 domready에합니까?

+0

예! 고맙습니다! – BigFella