我有这个声明
<div class="divShow">
<ul id="ulShow">
<li>
<h3 class="CompanyShow">A</h3>
<h2 class="ShowTitle">S</h2>
<input class="ExpShow" type="button" value="Edit">
</li>
<li>
<h3 class="CompanyShow">A2</h3>
<h2 class="ShowTitle">T1</h2>
<input class="ExpShow" type="button" value="Edit">
<li>
</ul>
</div>
当我单击"Edit"
按钮时,我必须显示相应的数据。
当我单击"Edit"
第一个列表的按钮时,它应该显示A
,如果我单击第二个li
,它应该显示A2
。
如何使用 jQuery 做到这一点?
$('.EditExp').live('click',function(){
$('.divShow ul li').each(function(){
alert($(this).parent().find('h3.CompanyShow').html());
});
});