강의

멘토링

커뮤니티

Inflearn Community Q&A

amuk021571103's profile image
amuk021571103

asked

jQuery tutorial more fun than TV

jQuery DOM text, html, val, attr document object model handling (2)

13강

Written on

·

350

0

$(document).ready(function(){

  $("#btn1").click(function(){

    $("#test1").text(function(i, origText){

      return "Old text: " + origText + " New text: Hello world! (index: " + i + ")"; 

    });

  });

의 i와 origText는 무엇을 뜻하는 것인가요?

jquery

Answer 1

1

https://www.w3schools.com/

들어가셔서 찾아보시면 나오더라구요 저도 궁굼해서 들어가봤습니다...

text(), html(), val() 이 세가지 메소드는 콜백함수도 같이 제공된다고 하네요

그콜백 함수에 1번째 파라미터는 인덱스 2번째 파라미터는 이전값 이렇게 두가지를 제공한다고 합니다

자세한 링크는 https://www.w3schools.com/jquery/jquery_dom_set.asp 여기에요

amuk021571103's profile image
amuk021571103

asked

Ask a question