javascript - how to find text of anchor tag on edit button click? -


   <div class="testcaselist_row"><ul><li id="tc_1" class="clicktestcaserow"><a href="#" style="color: #ffffff!important;">q</a><a class="delete deletetestcase_h"></a><button class="edit_h" href="#">edit</button></li></ul></div> 

can please tell me how find text of anchor tag on edit button click ?

$(document).on('click','.edit_h',function(e){     alert('rdit'+$(this).closest('li').attr('id'));//getting id     alert($(this).closest('a').text()); //getting undefined  shouted "q"     $("#edittestcaseid").popup("open");   e.stoppropagation(); e.stopimmediatepropagation(); }); 

the anchor tag trying find not parent. cannot use .closest()

try,

alert($(this).closest('li').find('a:first').text()); 

demo


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -