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: '#',
问题是IE将"class"视为保留关键字.把它放在引号中,像这样:
text: 'delete',
'class': 'icon-delete',
href: '#',
Run Code Online (Sandbox Code Playgroud)
这实际上是在$ .attr参考页面上说明的.
| 归档时间: |
|
| 查看次数: |
75 次 |
| 最近记录: |