user1407540
user1407540

Reputation: 101

JQuery works on Firefox not on Chrome

I have a two functions like this:

<script type="text/javascript" lang="javascript">
    $(document).ready(function() {
        $('div').hover(
            function() { $('> span', this).show(); }, 
            function() { $('> span', this).hide(); }
        );
    });
</script>

<script type="text/javascript">
    !function(d,s,id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (!d.getElementById(id)) {
            js = d.createElement(s);
            js.id = id;
            js.src = "//platform.twitter.com/widgets.js";
            fjs.parentNode.insertBefore(js,fjs);
        }
    }(document,"script","twitter-wjs");
</script>

<script type="text/javascript" lang="javascript">
    $.getJSON("http://twitter.com/statuses/user_timeline/username.json?callback=?&count=5", function(data) {
        $.each(data, function(index, value) { 
            $('.tweets').append('<div id='+data[index].id+'>'+data[index].text+'&nbsp<span style="display:none"class="hideTweeterIcons"><a href="https://twitter.com/intent/tweet?in_reply_to='+data[index].id+'"><img src="//si0.twimg.com/images/dev/cms/intents/icons/reply.png"></a><a href="https://twitter.com/intent/retweet?tweet_id='+data[index].id+'"><img src="//si0.twimg.com/images/dev/cms/intents/icons/retweet.png"></a><a href="https://twitter.com/intent/favorite?tweet_id='+data[index].id+'"><img src="https://si0.twimg.com/images/dev/cms/intents/icons/favorite.png"></a></span></div><hr>');
        });     
    });
</script>

However, the hover part of function does not work in Chrome. It works fine in Firefox. What's wrong? I know that Chrome has better webkit. What's wrong ?

Upvotes: 0

Views: 198

Answers (1)

Mohammed Swillam
Mohammed Swillam

Reputation: 9242

Write them this way and they gonna work fine:

$('div').hover(function()
    {
        $(this).find('span').show();
    }, function()
    {
        $(this).find('span').hide();
    });

let me know if this has worked, and if you need another scenario, let me know so I may modify my answer, thanks.

Upvotes: 1

Related Questions