JavaScript Onclick Method calling

i have Two videos on same page with custom controls. My issue is that i have same onclick functions name but defined in different div class. My task is to use that same function but video should be played only if that video is inside its own class.

Show us the HTML.

It sounds like you have JavaScript jumbled with the HTML the way it used to be done in Netscape 4. Your script will be easier to maintain if you put all the JavaScript in a separate file. You could probably do this with one click event listener on the entire page that then checks where the click occurred in order to process the appropriate video.

2 Likes

This will work even if the same video is played on the same page? and also i have the same function in both div block.

The function shouldn’t matter. Show us what you have.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.