我有以下代码:
<ul>
<li id="1">same html structure as below...</li>
.....
<li id="42">
<div class="input-prepend">
<button class="btn btn-small companyListBtn addMarkerBtn btn-primary btn-warning" type="button"> </button>
<input class="input-medium companyListInput" maxlength="60" type="text"/>
<button class="companyListBtn editCompanyBtn" type="button"></button>
</div>
<div id="42Div" class="companyAddressDiv">
<input type="text" id="test" class="companyAddress" placeholder="Enter the Address"/>
<button class="btn btn-small compAddressSubmit" style="height:30px;margin-top:-9px;" type="button"></button>
</div>
</li>
</ul>
$(document).on('click','.compAddressSubmit', function () {
alert("clicked");
//my logic going on here...couldnt mention everything...
});
上面的所有代码都工作正常......唯一的问题是onclick仅在我使用鼠标单击按钮时执行......但不适用于键盘输入按钮......我试过 .keydown,.bind和.live并尝试使用列表器,但对它们不清楚....我知道这不是一个大问题,但无法解决问题....请提供任何帮助....谢谢