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

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -