我想要防止輸入焦點onclick和焦點輸入雙擊。雙擊焦點輸入?
喜歡的東西....
$('input').click(function) {
$(this)preventFocus();
});
$('input').dblclick(function) {
$(this)focus();
});
或者,也許我應該使用if語句?
我想要防止輸入焦點onclick和焦點輸入雙擊。雙擊焦點輸入?
喜歡的東西....
$('input').click(function) {
$(this)preventFocus();
});
$('input').dblclick(function) {
$(this)focus();
});
或者,也許我應該使用if語句?
你可以嘗試像下面
HTML:
<input type="text" id="myInput" readonly="readonly" />
的jQuery:
$("#myInput").dblclick(function(){
$(this).prop("readonly", false)
});
$("#myInput").blur(function(){
$(this).prop("readonly", true);
});
試$(本).blur()而不是$(本)preventFocus() –
你有沒有真的試圖什麼嗎?檢查出:http://stackoverflow.com/questions/8735764/prevent-firing-focus-event-when-clicking-on-div –
一直嘗試2小時隊友:(我會看看這個答案,謝謝 – colmtuite