jquery - How to get the previous text value of a div by clicking a html item? -


in image below html code: enter image description here

and js code:

$(".salveazatransasuma").click(function(){    var payment_name = $(this).siblings().previous(".transacontentedit").text();    alert(payment_name); }); 

so want text value transacontentedit class, when click on salveazatransa class. don't worry white spaces before , after text value ("servicii programare transa 1"). appearantly code doesn't work. gives me error in firebug "typeerror: $(...).siblings(...).previous not function". idea how hande ?

based on image, can use:

$(".salveazatransasuma").click(function(){    var payment_name = $(this).closest('.litransa').prev().find(".transacontentedit").text();    alert(payment_name); }); 

Comments

Popular posts from this blog

python - matpltolib navigation toolbar edit curves and parameters line color automatically changes issue -

python - Redis Error 8 connecting localhost:6379. nodename nor servname provided, or not known -