코딩애플을 통해 자바스크립트를 공부해보려고한다.
첫 강의에는 강의 소개와 자바스크립트의 근본에 대해 진행됨
코드를 짤 때에는 script 태그 안에 작성하면된다.
<h1 id="hello">안녕하세요</h1>
<script>
document.getElementById('hello').innerHTML='안녕';
</script>
위의 코드에서 'getElementById'는 인터페이스 메서드로 속성에 지정된 ID값에 일치하는 개체를 document에 반환하는 방식이다.
h1태그 안에 내부글자 사이즈를 16px로 변경해오십시오.
자바스크립트로 font-size 변경하는 법을 찾아보기.
<h1 id="tit">Hello JS</h1>
<script>
document.getElementsByClassName('tit').style.fontSize="16px";
</script>
<script>
$(#tit).css("fontSize", 20);
$(#tit).css("fontSize", "20px");
$(#tit).css("font-size", "20");
$(#tit).css("font-size", "20px");
</script>