여기에 내가 가지고 시도하고 무슨 일이 :JQuery와 다음
- 사람이 입력 필드
- 그들의 키보드
ENTER
충돌에 텍스트를 입력, 그것은 추가after()
기능을 사용하여 현재 입력 필드 AFTER 입력 필드는 다음 입력 필드 그래서 그들은 계속 입력이 이상을하고를 heres 내 코드
이상 작동하지 않는 수 초점을 맞추고 :
$('.table-todo input[type=text]').live('keypress', function (e) {
if (e.which == 13)
{
$parent = $(this).parent('.field');
$.get('projects-add-task.php?show_delete=yes', function (data) { $parent.after(data); }, 'html');
$(this).next('input[type=text]').focus();
}
});
을 heres projects-add-task.php
의 내용 :
<div class="field">
<input type="text" name="task[]" />
<a href="#" title="Add Task Below" class="todo-add"><img src="images/icon-todo-add.png" alt="" onmouseover="this.src='images/icon-todo-add-h.png'" onmouseout="this.src='images/icon-todo-add.png'" /></a>
<?php if ($_GET['show_delete'] == 'yes') { ?>
<a href="#" title="Delete This Task" class="todo-delete"><img src="images/icon-todo-delete.png" alt="" onmouseover="this.src='images/icon-todo-delete-h.png'" onmouseout="this.src='images/icon-todo-delete.png'" /></a>
<?php } else { ?>
<img src="images/icon-todo-delete-o.png" alt="" />
<?php } ?>
<div style="clear: both;"></div>
</div>
의 단지 $.get
를 통해 추가 된 입력을 집중하지 그리고 난 그것을 해결하는 방법을 알아낼 질수. 그것은 페이지에 다음 입력 필드를 추가하는 것이지만, 그것을 집중하지 않습니다.
http://jsfiddle.net/에서 문제를 재현하고 링크 할 수 있습니까? 코드를 직접 실행할 수 있다면 사람들이 쉽게 도울 수 있습니다. –
'$ (this) .next ('input [type = text] ')하지 않아야합니다. – banzomaikaka