【发布时间】:2011-12-30 21:09:43
【问题描述】:
请看这个小提琴:
当提交按钮被按下一次时,它会无缘无故地删除文本编辑,但不做任何事情,但第二次按下时它会起作用,并进入页面。
请帮助我了解是什么让这段代码做到了这一点。
谢谢
HTML:
<b class = "edit" id = "fooo"> FOO </b>
JS:
$('b.edit').click(function() {
$(this).hide().after('<form action = "foo.php" method = post><input hidden name = "field" type = "text" value = "' + this.id + '"/><input type="text" name = "period" class="editP" value="' + $(this).html() + '" /><input type = "submit" value = "Submit!!" /></form>');
$('.editP').focus();
});
$('.editP').live('blur', function() {
$(this).hide().prev('b.edit').html($(this).val()).show();
});
【问题讨论】:
标签: javascript html forms submit textinput