我想解決在Firefox上單擊選擇文本使用jQuery
以下問題,當我嘗試用雙擊鼠標選擇文本中的文本其不選擇光標去的開始文本text.Any想法如何解決這個問題?但這工作正常googlechrome
我試圖從這個http://www.iwebux.com/demos/ajax/以下這個鏈接,當你嘗試編輯價格列你不能選擇值。謝謝。
我的代碼:
$(document).ready(function() {
$('td.edit').click(function() {
$('.ajax').html($('.ajax input').val());
$('.ajax').removeClass('ajax');
$(this).addClass('ajax');
$(this).html('<input id="editbox" size="' + $(this).text().length + '" type="text" value="' + $(this).text() + '">');
$('#editbox ').focus();
});
$('td.edit').keydown(function (event) {
arr = $(this).attr('class').split(" ");
if (event.which == 13) {
$.ajax({
type: "POST",
url: "supplierprice/config.php",
data: "value=" + $('.ajax input').val() + "&rowid=" + arr[2] + "&field=" + arr[1],
success: function (data) {
$('.ajax').html($('.ajax input').val());
$('.ajax').removeClass('ajax');
}
});
}
});
$('#editbox').live('blur', function() {
$('.ajax').html($('.ajax input').val());
$('.ajax').removeClass('ajax');
});
});
這將導致你不能點擊裏面的文字,之後單擊該文本將始終選擇。 – HarryFink
@HarryFink啊!是的,這個有這個問題。你的解決方案將會更好。 – Bubi