JQuery 기초기초

it/jQuery 2014. 8. 21. 09:28 Posted by 하얀나다

<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>JQuey 연습</title>
<script src = "../lib/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
 $(function(){
  $('.divText').text('<img src = "images/puppy.jpg">');
  $('.divHtml').html('<img src = "images/puppy.jpg">');
  $('.divEmpty').empty();
  
  $('#grim').attr('src','images/cat.jpg');
 });
</script>
</head>
<body>
 
 <div class = "divText">여기1</div>
 <div class = "divHtml">여기2</div>
 <div class = "divEmpty">여기3</div>
 
 그림 : <img src = "images/puppy.jpg" id = "grim">
</body>
</html>