Reputation: 85653
I've applied the following jquery but could not get worked.
var medialink = $('<a>',{
class: 'all-videos-link',
href: 'index.php?option=com_content&view=category&layout=blog&id=78'
});
$('#custom-module .moduletable').eq(2).find('h3').append(medialink);
In all browser it's working but not in IE. I tested in ie8. So I tried this
$('#custom-module .moduletable').eq(2).find('h3').css({background:'red'}); // and it's working
So, why append is not working for ie only.
Upvotes: 0
Views: 88
Reputation: 253496
You need to quote the property-name class
, as it's a reserved word, in the case of class
a 'future keyword,' in JavaScript. Therefore, you should use:
var medialink = $('<a>',{
'class': 'all-videos-link',
href: 'index.php?option=com_content&view=category&layout=blog&id=78'
});
Though I find it easier to simply quote all property-names of an object, since it reduces the need to remember which ones must be quoted (and under which implementation of ECMAScript they must be quoted), to give:
var medialink = $('<a>',{
'class': 'all-videos-link',
'href': 'index.php?option=com_content&view=category&layout=blog&id=78'
});
References:
Upvotes: 1
Reputation: 9411
You are probably using jQuery 2.0.0 which doesnt support IE8. Try getting an older version such as 1.9.
Upvotes: 0