Convert table cells to text-boxes with JQuery

前端 未结 2 840
轮回少年
轮回少年 2021-01-18 11:21

I have a table, shown below:



        
                      
相关标签:
2条回答
  • 2021-01-18 11:43

    You don't even need Javascript/jQuery:

        <table>
            <tr>
                <td><input type="text" value="My Thing"></td>
            </tr>
        </table>
    input {
     border:none;
    
    }
    input:active {
        border:1px solid #000;
    }
    

    ...just use CSS to style the input to look like a span.

    0 讨论(0)
  • 2021-01-18 11:46
    $('#editParamValues').click(function () {
        $('tr td:nth-child(3)').each(function () {
            var html = $(this).html();
            var input = $('<input type="text" />');
            input.val(html);
            $(this).html(input);
        });
    });
    
    0 讨论(0)
提交回复
热议问题
Name