Problem I am working on a school presentation but in which I am replacing the .swf animations using jQuery but it doesn't work. If copy the same code over to my console, it works like a charm! Any help?
My Code
<html>
<body>
<div class='div-header'>
<div class='div-header-title'>Courier Services</div>
</div>
<div class='div-animation-frame'>
<h2>A Project By</h2>
<ul>
<li>Naqi</li>
<li>Musa</li>
<li>Husnain</li>
<li>Nafey</li>
<li>Saeed</li>
<li>Hanzala</li>
</ul>
<button class='button-start'>START</button>
</div>
$(document).ready(function() {
var companiesList = ['tcs', 'ocs', 'dhl', 'leopards'];
var currentIndex = 0;
$('.button-start').on('click', function() {
$('body').append("<div class='div-next-fab'></div>");
$('.div-next-fab').append("<i class='fas fa-arrow-right'>");
$('.div-animation-frame').replaceWith('<div class="div-animation-frame"><embed src="tcs.swf"></div>');
})
// Clicking on the next button will swap the animation file
// Somehow not working
// Copy this to console, hit enter
// It now works
$('.div-next-fab').on( 'click', function() {
$('.div-animation-frame').replaceWith("<div class='div-animation-frame'><embed src='ocs.swf'></div>");
})
});