JQuery .each() and IE all versions problem
i am using this code and it is working on all browsers without a glitch but with IE all versions it`s not working can anyone help me with this
$('a.download').each(function() {
$(开发者_开发技巧this).colorbox({href:$(this).attr('href') + ' div#download_popup',onComplete: function(){
$('div.sociable').hide();
$('a#share_button').click( function(){
$('div.sociable').slideToggle().show();
});
}})});
$('a.download').each(function()
{
$(this).colorbox(
{
href: $(this).attr("href") + ' div#download_popup',
onComplete: function()
{
$('div.sociable').hide();
$('a#share_button').click(function()
{
$('div.sociable').slideToggle().show();
});
}
});
});
When you align code blocks vertically, it is easier to see missing curly braces,parentheses, or semicolons.
Cleaning up the code (somewhat better anyhow), it looks like it's missing a semicolon
$('a.download')
.each(function() {
$(this).colorbox({
href: $(this).attr('href') + ' div#download_popup',
onComplete: function() {
$('div.sociable').hide();
$('a#share_button').click(function() {
$('div.sociable').slideToggle().show();
});
}
}); // RIGHT HERE
});
$('a.download').each(function() {
$(this).colorbox({
href:$(this).attr('href') + ' div#download_popup',
onComplete: function() {
$('div.sociable').hide();
$('a#share_button').click( function() {
$('div.sociable').slideToggle().show();
});
}
}) // - missing semicolon goes here
});
You are missing a semicolon.
精彩评论