jQuery data / read /write

vanillaimpl·2023년 9월 13일

data attribute

$(this).attr("data-id")

$(this).data("id")

$(this).data("id", "123")

예]
<span data-id="seckeypad" data-pad-type="half" > pad </span>

$("span[data-id=seckeypad]").data("pad-type");

>>  "half"
  • data- 이후는 반드시 소문자로 해야 동작한다
profile
대부분의 사람들은 사회에 순응하며 자신을 적응시키지만, 일부 사람들은 사회에 적응하지 못하며, 사회를 오히려 자신에 적응시키려고 한다. 사회는 이런 비 적응자에 의해서 발전되었다. - 라이너스 폴링 -

0개의 댓글