IE(jQuery代码)的问题

Che*_*rio 1 jquery internet-explorer

我有IE的问题(我想支持IE用户Grrrr):


$(function () {
    var clonedField = $('.child').clone(),
        main = $('.append');
    $('', {
        text: 'delete',
        class: 'icon-delete',
        href: '#',
        click: function () {
            $(this).parent().remove();
            return false;
        }
    }).appendTo(clonedField);
    $('#add-input').click(function () {
        main.append(clonedField.clone(true));
        return false;
    });
})

错误是:expected identifier, string or number
第142行:href: '#',

ale*_*exn 5

问题是IE将"class"视为保留关键字.把它放在引号中,像这样:

text: 'delete',
'class': 'icon-delete',
href: '#',
Run Code Online (Sandbox Code Playgroud)

这实际上是在$ .attr参考页面上说明的.