编辑的时候获取默认值

1.弹出框表单里面获取对应要编辑的值  (jQuery 取值+赋值)

<tr>
                        <td>{{item.fid}}</td> 3
                        <td>{{item.name}}</td> 2
                        <td>{{item.price}}</td>  1 
                        <td>{{item.quantity}}</td>  0
                        <td><a onclick="show_edit(this);">编辑</a></td>

 </tr>
function  show_edit(ths){
          
   document.getElementById(‘shadow_edit‘).classList.remove(‘hide‘);
          
   document.getElementById(‘modal_edit‘).classList.remove(‘hide‘);




          var row= $(ths).parent().prevAll();  查找 这个onlick对应的父标签 全部
          console.log(row[2]);  测试:  从下往上找 0 1 2 3


          var content=$(row[2]).text();  取对应位置的值
          $(‘#title_txt‘).val(content);  把值赋值给id 为title_txt的input

 

 

 

编辑的时候获取默认值

上一篇:Exchange 2016 限制邮件大小


下一篇:序列和索引