How to get elements at different levels

Code:

$(".jia").on("click",function(){
      //28
      //545
})
$(".jian").on("click",function(){
      //28
      //545
})

because there are multiple items, you can"t get it with $(".title _ width4"). Text ();), which is troublesome and duplicates if there are multiple items. What I want to get is to find a level selector

Mar.06,2021

get 28). Closest ($('.jian'). Closest ('li'). Pre (). Text ();
) (' .jian'). Closest ('li'). Next (). Text ();


I see you have id, you can use id


$(".jia").on("click",function(){
  $(this).find(".title_width4")
})

$('-sharpdel1').click(function(){
        console.log($(this).parent().parent().parent().find($('-sharpprice1')).html())
})
$('-sharpadd1').click(function(){
        console.log($(this).parent().parent().parent().find($('-sharptotal1')).html())
})

find is the result of the element selection that returns the descendants of the current element. Fill it with a selector.

Menu