Skip to content Skip to sidebar Skip to footer

Convert Table Cells To Text-boxes With Jquery

I have a table, shown below:
NameValue 

Solution 1:

$('#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);
    });
});

Solution 2:

You don't even need Javascript/jQuery:

<table><tr><td><inputtype="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.

Post a Comment for "Convert Table Cells To Text-boxes With Jquery"