I may be going about this in completely the wrong way, but I'm pretty new to JavaScript and this was the easiest way I could figure out to do it. I'm trying to have a thumbnail at the top of my page be replaced by a JW Player video when a button is clicked. Here is my code so far:
HTML
<div class="series_graphic"></div>
<button class="button-watch1">Watch now</button>
JQuery
$( ".button-watch1" ).click(function() {
$( ".series_graphic" ).replaceWith( '<div id="player-1">Loading</div>');
});
jwplayer("player-1").setup({
file: "",
height: 360,
image: "",
width: 640
});
I can get it to work just fine if I remove the .click function, but as soon as I add it, all that it will show is the "Loading" text and nothing else. I've done quite a bit of troubleshooting/searching and can't seem to figure it out. I've also tried an onclick on the button and it returned the same results.
Sorry if this is a super dumb/simple question. I really appreciate any help as I've spent a long time trying to figure it out!