I noticed something else that is a little weird when cloning.
If I execute the following snippet, I see the table tags and all the
inner html:

var $template = $("#LineItemsTableTemplate").clone()
alert($template.html());

<div id='LineItemsTableTemplate'>
    <table class='gridview' style='width:100%'>
        <tr class='gvheader'>
            <th>Item Code</th>
            <th>Price Level</th>
            <th>Description</th>
            <th>Qty</th>
            <th>Subtotal</th>
            <th>Tax</th>
            <th>Total</th>
        </tr>
    </table>
</div>

, however if I execute the following snippet, I only see the tr tags.
Why is that? I would expect to clone the entire matched element, not
just the inner html of the matched element.

var $template = $("#LineItemsTableTemplate").clone()
alert($template.html());

<div>
    <table id='LineItemsTableTemplate' class='gridview' style='width:
100%'>
        <tr class='gvheader'>
            <th>Item Code</th>
            <th>Price Level</th>
            <th>Description</th>
            <th>Qty</th>
            <th>Subtotal</th>
            <th>Tax</th>
            <th>Total</th>
        </tr>
    </table>
</div>

Reply via email to