클릭 할 때 범위로 변환하고 바깥 쪽을 클릭하면 범위가 다시 변환됩니다. 그러나 그것은 단지 한 번 변환하고 다시는 발생하지 않습니다.클릭시 입력 범위로 변환
다음은 코드입니다.
$(function() {
$(document).on('click', 'span.loadNum', function() {
var input = $('<input />', {
'type': 'text',
'name': 'unique',
'value': $(this).html()
});
$(this).parent().append(input);
$(this).remove();
input.focus();
});
$(document).on('blur', 'input', function() {
$(this).parent().append($('<span />').html($(this).val()));
$(this).remove();
});
});
그리고
<span class="loadNum">Hasha</span>
<span class="loadNum">dbhfb</span>
은 또한 사람이 내가 변환 입력 태그에 Enter 키를 누릅니다 때 아약스 전화를 제출해야이를 달성하는 방법을 알 수 있습니다 걸쳐있다.
http://jsfiddle.net/hW3vk/114/ – Alexis