Javascript 点击td标签时,获取td中的p标签值之一

Javascript 点击td标签时,获取td中的p标签值之一,javascript,jquery,html,Javascript,Jquery,Html,请帮帮我 我想检测td上的窃听。但我还需要在点击时获取p标签(cal_date)值之一。 如何获取cal_日期值 JQUERY当前代码: $( document ).on ( "tap", "td", function(event) { //code here // i want to get the cal_date value in this block }); 我不能用这种方式,因为它只能检测p.cal_日期标签上的点击,而不能检测td标签上的点击 $( documen

请帮帮我

我想检测td上的窃听。但我还需要在点击时获取p标签(cal_date)值之一。 如何获取cal_日期值

JQUERY当前代码:

$( document ).on ( "tap", "td", function(event) { 
    //code here
    // i want to get the cal_date value in this block
});
我不能用这种方式,因为它只能检测p.cal_日期标签上的点击,而不能检测td标签上的点击

$( document ).on ( "tap", ".cal_date", function(event) {

});
HTML:

7


16


在点击的TD中找到
.calu date
元素,并获取其文本

$(document).on ("tap", "td", function(event) { 

    var value = $(this).find('.cal_date').text();

});

点击
处理程序
中,此
引用点击的
td
元素,因此您可以使用
.find()
获取其中的
cal\u date
元素

$(document).on("tap", "td", function(event) {
  //code here
  // i want to get the cal_date value in this block
  var cal_date = $(this).find('.cal_date').text()
});

谢谢这正是我想要的!
$(document).on("tap", "td", function(event) {
  //code here
  // i want to get the cal_date value in this block
  var cal_date = $(this).find('.cal_date').text()
});