我正在尝试在页面加载时将其放在何处,它将自动加载我在文本框中的代码,我在想也许使用 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>
$(document).ready(function(){
$('#DisplayCode').html($("#Code").val());
$('#Code').keyup(function(){
$('#DisplayCode').html($(this).val());
});
});
简单地在 domready 上这样做?