Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7914429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:06:44+00:00 2026-06-03T14:06:44+00:00

I have two functions, one plays a video on click (and changes the video

  • 0

I have two functions, one plays a video on click (and changes the video that plays) on click, and then a function that is supposed to make a DIV’s opacity go to zero. I tried to put them together because you’re supposed to click on the same spot to activate both, but it doesn’t work.

For some reason, when I put the div that contains the video (even without its function), the second function stops working. What can I do to make then work?

The function for the video player is:

$(window).load(function(){
    $('li', '.thumbs').on('click', function() {
        var numb = $(this).index(),
            videos = ['images/talking1.m4v', 'images/talking2.m4v', 'images/talking1.m4v', 'images/talking2.m4v', 'images/talking1.m4v', 'images/talking2.m4v'],
            myVideo = document.getElementById('myVid');

        myVideo.src = videos[numb]; 
        myVideo.load();
        myVideo.play();

    });
});

And for the image:

$(window).load(function(){
    $(function() {
        $('li', '.thumbs').click(function() {
            $('#MyT').addClass('clear');
        });
    });
});

I know that both shouldn’t have $(window).load(function(), that just because these are the separate ones.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:06:46+00:00Added an answer on June 3, 2026 at 2:06 pm

    Are you sure your multiple selector syntax is what you want?, the comma separated selectors must be quoted just once if you want to apply it to all those element otherwise the you’re just passing a context. In any case, I usually find the context unnecesary unless it’s a previously cached selector. More info at the jQuery API.

    $('li, .thumbs') // All `li` and all `.thumbs`
    $('.thumbs li') // All 'li` within `.thumbs`
    

    Notice that you’re also using (window).load() and (document).ready(). When you combine both choose one or the other. There’s a slight but important difference. Then you can combine everything like this and it should work.

    $(document).ready(function () {
    
        $('li, .thumbs').on('click', function () {
    
            // Add class
            $('#MyT').addClass('clear');
    
            // Video stuff
            var numb = $(this).index(),
                videos = [
                    'images/talking1.m4v',
                    'images/talking2.m4v', 
                    'images/talking1.m4v', 
                    'images/talking2.m4v', 
                    'images/talking1.m4v', 
                    'images/talking2.m4v'
                ],
                myVideo = document.getElementById('myVid');
                myVideo.src = videos[numb];
    
            myVideo.load();
            myVideo.play();
    
        });
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two functions that return simple strings. Both are registered. $.views.helpers({ parseDate: function
I have two functions—one that builds the path to a set of files and
I have two functions: one that creates a new <textarea> when a button is
Inside my view.py, I have two functions, one that processes input from a form
I have two functions, but one of the functions is only called from the
I have two functions whose underlying logic is the same but in one case
I have two jQuery functions. The first one below I want to run first,
i have two data classes which hold only data members(no functions). One is CallTask
Hi I have a program written in C++ in which one or two functions
I have two function and I need to execut in one onClick . The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.