How to get the data-id attribute?

后端 未结 15 2452
青春惊慌失措
青春惊慌失措 2020-11-21 23:29

I\'m using the jQuery quicksand plugin. I need to get the data-id of the clicked item and pass it to a webservice. How do I get the data-id attribute? I\'m using the .

15条回答
  •  广开言路
    2020-11-21 23:43

    Try

    this.dataset.id
    

    $("#list li").on('click', function() {
      alert( this.dataset.id );
    });
    
    
    

提交回复
热议问题