Programming/Javascript, jQuery
javascript access data attriute (데이터 속성 값 가져오기)
ehdtnn
2016. 12. 7. 10:06
반응형
<span class="field" data-fullText="This is a span element">This is a</span>
Javascript
console.log( document.getElementsByClassName('field').getAttribute('data-fullText' );
jQuery
console.log( $('.field').data('fullText') );
반응형