Home > Article > Backend Development > javascript - I want to get data-status and other data in h4. How should I write it in js code?
$('.operation h4').click(function(){}), so there is no need to change it.
There is a problem with your code. Your .operation
is a td element, and the this returned by click should also be this element.
Minimal changes should be like this.
<code>$('.operation').click(function(){ var el = $(this).find('h4'); console.log(el.attr('data-status')); });</code>
<code>$(this).find("h4").data("status")</code>