live_game3
live_game3

Reputation: 1

How can i hide a preview of a video in html

I am kinda trying to build my first website atm. I was trying to create a button that would start a video if it was pressed (that already works), but i don't want a preview of the video if the button wasn't pressed. How can i hide the video before the button is being pressed?

Upvotes: 0

Views: 471

Answers (1)

Gicu Aftene
Gicu Aftene

Reputation: 532

Put a style='display: none' attribute in the video tag element. And then, in the botton's click handler, insert this document.getElementById("your-video-element-id").style.display = 'block'; in order to make it visible.

For a similar example look here: https://www.w3schools.com/howto/howto_js_toggle_hide_show.asp

Upvotes: 1

Related Questions