I used to use the following syntax when using (previous versions of) jQuery:
jQuery('<span/>', {className: 'a'};
Using jQuery 1.6.2 the same will create classname attribute on the element and not class. So I tried using (the reserved word) class and it works, but only in (latest-ish) Chrome and Firefox. IE 7 will choke on the reserved word.
What am I missing here? The (truncated) script is below:
jQuery('<div/>', {
className: 'wrap'
})
.append(jQuery('<div/>', {
className: 'button',
html: jQuery('<a/>', {
href: function() {
return '#'
}(),
className: 'amaranth',
html: '<span>View in</span> Site'
})
}))
.appendTo(that);
You can just put quotes around the keyword
class, which is more valid JSON anyway