views:

58

answers:

3

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: 
$('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.

realshadow
i tried it but it didn`t fix the problem
Gabri
Since I cant see your html, I am not sure whats going on, but my guess would be that there is something wrong with the href. What are you trying to pull there? Try without the space and/or without the div before #.
realshadow
i`m trying load an external div inside colorbox , and if the href is wrong it won`t work in other browsers as far as i know ?
Gabri
@Gabri, did you try adding the missing semi-colon, or did you try what realshadow posted, because what is posted, doesn't contain the missing semicolon
Chad
I didnt write the missing semicolon, because it seemed obvious, but since you pointed it out and did post in your answer, +1 :)
realshadow
@Chad yes i tried adding the semi-colon with no luck
Gabri
to be more clear this div i`m trying to load has dynamic info comes from Wordpress , maybe it will make a difference
Gabri
+1  A: 

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
    });
Chad
Add some alert statements to see if things are what you expect.Specifically things like `alert($('a#share_button').length);` and `alert($('div.sociable').length);` and place an alert in the onComplete function to make sure it's being fired.
Chad
+1  A: 
$('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.

Tr41n