jQuery ID와 Name

Posted by RAY.D
2015. 4. 13. 23:20 Web/javascript / jQuery
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.





기본이지만 가끔 헷갈린다.





Name으로 가져올때

 

$('.myclass').live('click', function() {
   alert
(this.id); //or alert($(this).attr('id'))); for the jQuery method
});

 

 

 

 Id로 가져올때

 

$('#myclass').live('click', function() {
   alert
(this.id); //or alert($(this).attr('id'))); for the jQuery method
});