<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<div id="hello">hello</div>
<h4>val()</h4>
<input type="text" />
<button type="button" onclick="getValue()">값 가져오기</button>
<button type="button" onclick="setValue()">값 설정하기</button>
//jquery
//$("선택자").동작함수("");
//text
//console.log($('#hello').text());
$('#hello').text('bye');
$('#hello').css('font-size', '60px');
//jquery method
//val()
function getValue() {
let value = $('input').val(); //값 가져오기
console.log(value);
}
function setValue() {
$('input').val('설정완료');
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.