您的位置:首页 > Web前端 > JQuery

jquery实现双击修改td内容的方法

2016-04-15 16:29 706 查看
$(function(){

 
     $("#table").find("tr:eq(1)").find("td:lt(3):gt(0)").bind("dblclick",function(){ 

          var input="<input type='text' id='temp' size='20'value="+$(this).text()+" >"; 

         $(this).text(""); 

         $(this).append(input); 

         $("input#temp").focus(); 

         $("input").blur(function(){ 

            if($(this).val()==""){ 

               $(this).remove(); 

            }else{ 

               $(this).closest("td").text($(this).val()); 

             }

          })

       })

   }); 

html代码
idnamepasswordCreateCardUpdate
9username111111CreateCardUpdate
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: