jquery - HTML not working with JavaScript -


this question exact duplicate of:

it seems javascript won't run when put in html <script></script> works fine online tool. javascript should able replace image video when image clicked. how can add html?

it work fine while using online tool http://jsfiddle.net/odoycz6n/3/

html

<img src="http://www.whatever9495.com/template/damei_d21/image/logo.png" data-video="https://drive.google.com/file/d/0bwbk-p9knhkga21vszyzmfl6yxm/preview"> 

javascript

$('img').click(function() {   video = '<iframe src="' + $(this).attr('data-video') + '"   width="715" height="480" frameborder="0" allowfullscreen=""></iframe>';   $(this).replacewith(video); }); 

jsfiddle loads jquery default. need load jquery before using in own code like

<script src="http://code.jquery.com/jquery-1.12.0.min.js"></script> 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -