Reputation: 1827
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
jQuery('#pworld,#pauto,#psubmit').attr({
href: 'mailto:[email protected]?subject=test',
class: 'pullup'
});
};
The above code seems to work fine but I get an error on IE8 on the line class: 'pullup'
SCRIPT1028: Expected identifier, string or number
Why is that?
Upvotes: 1
Views: 1431
Reputation: 413712
You can't use class
as a property name in an object literal without quoting it.
"class": 'pullup'
should work. In one of his essays (or whatever they are) Crockford explains that this restriction is not necessary for syntactic disambiguation, but the rule's there anyway.
Upvotes: 4