![](https://secure.gravatar.com/avatar/490b9dbe453e3b6b837bf5d26d0d0a8b?rating=PG&size=50&default=https%3A%2F%2Fcdn.desk.com%2Fassets%2Funknown_user_50-8ad5644bbe6b1bd7454f2ea465f782bd.png)
Replacing thumbnail with embedded player
I'm trying to add a feature where clicking an image thumbnail (with a button that has id "feature-play") will swap out the image for an embedded JWPlatform video. Code looks something like this:
<script type="text/javascript">
$("#feature-play").click(function() {
$( "div.video-content").empty();
$.getScript("http://content.jwplatform.com/players/<?php echo $videoid; ?>-iqSlSRbk.js",
function(data){
$('div.video-content').html(data);
});
});
</script>
It looks like it's loading the script and trying to run it, but the console reports an error: "TypeError: undefined is not a function (evaluating 'jwplayer("botr_[redacted video ID]_div").setup')"
Does anyone know a better way of loading a JWPlatform video dynamically into a div?