After the folder is renamed, the input box loses focus and the input disappears. Get the value of the input box so that the text value of its parent tag is the input value. How to achieve this?
htmlcode
<p class="subject_folder_box hidden">
<ul class="subject_folder_ul">
<li class="subject_li_1">
<a><span class="folder_name">默认文件夹</span>(<span class="floder_num">1</span>)</a>
</li>
</ul>
<p class="subject_edit_li">
<a title="添加" class="add_subject js_add" id=""></a>
<a title="编辑" class="edit_subject js_edit" id=""></a>
</p>
</p>
js code
//编辑文件夹
$(".js_edit").click(function(){
$(".subject_folder_ul li a").append("<a title='重命名' class='edit_subject js_edit1' id=''></a>");
});
//重命名文件夹
$(".js_edit1").live("click",function(){
$(this).hide();
var txt=$(this).siblings(".folder_name").text();
$(this).parents("a").find(".folder_name").empty();
$(this).parents("a").find(".folder_name").append("<input type='text' name='' maxlength='10' id='' value='"+txt+"'/>");
});
//添加文件夹
$(".js_add").click(function(){
$(".subject_folder_ul").append("<li><input type='text' name='' maxlength='10' id='' placeholder='请输入子类名称'/></li>");
});
//input输入框失去焦点
$(".subject_li_1 input").on("blur",function(){
var value=$(this).val();
$(this).remove();
$(this).parents(".folder_name").text(value);
});