2017년 8월 31일 목요일

JQuery text함수

text함수는 특정 element의 text value를
얻기(get)도하고 결정하기(set)도 한다.

Source

$(document).ready(function(){
    $("#btn1").click(function(){
        alert("Text: " + $("#test").text());
    });
    $("#btn2").click(function(){
        $("#test").text("Hello world!");
    });
});

Result

This is a paragraph.


*모바일버전에서는 button click이 안되요. 
 웹버전으로 보세요

댓글 없음:

댓글 쓰기