我有以下代碼:上點擊按鈕不響應的keydown
<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並試圖用listiners但wasnt明確與他們....我知道它不是一個大問題,但不能得到噸他的頭周圍....任何幫助,請....謝謝
你在哪裏試過'.keydown()','.bind()'或'.live()'?我只看到'click'。 – Dom
我的意思是$(document).keydown,$(document).bind ...我不能使用它們的原因是他們給我的邏輯,我實現了非理性... – troy