阅读背景:

使用复选框事件jquery将输入文本元素附加到表

来源:互联网 
$('#form-upload :checkbox').click(function () {
    var $this = $(this);
    // $this will contain a reference to the checkbox

    if ($this.is(':checked')) {
        // the checkbox was checked
        var sku_td = $('#sku').text()
        var price_td = $('#price').text()
        var quantity_td = $('#quantity').text()

        $('#price').empty()
        $('#quantity').empty()

        var sku = $('<input type="hidden" name="sku[]" value="' + sku_td + '">')
        var price = $('<input type="text" name="price[]" value="' + price_td + '">')
        var quantity = $('<input type="text" name="quantity[]" value="' + quantity_td + '">')

        $('#sku').append(sku)
        $('#price').append(price)
        $('#quantity').append(quantity)

    } else {
        // the checkbox was unchecked

        // undo every you did when you clicked the event

    }
});
$('#form-upload :checkbox').click(function () {



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: