首页 > PHP资讯 > HTML5培训技术 > jQuery实现点击按钮文字变成input框点击保存变成文字_jquery

jQuery实现点击按钮文字变成input框点击保存变成文字_jquery

HTML5培训技术
废话不多说,直接给大家贴代码了。

具体代码如下所示:

      点击按钮文字变成input框,点击保存变成文字    <script type="text/javascript" src="js/jquery.min.js?1.1.14">《script》                                                                                                                                    
品名件数
iPhone6s2
小米55
                  
<script type="text/javascript">function change(obj){  var xg=$(obj).html();  if(xg=='修改'){    $('.edit').each(function(){      var old=$(this).html();      $(this).html("");    })    $(obj).html('保存');  }else if(xg=='保存'){    $('input[name=editname]').each(function(){      var old=$(this).html();      var newfont=$(this).parent('td').parent('tr').children().find('input').val();      $(this).parent('td').html(newfont);    })    $(obj).html('修改');  }}《script》

HTML5培训技术

本文由欣才IT学院整理发布,未经许可,禁止转载。
支持25不支持0