I want to switch the twitter feed to dark/light mode when clicking on the buttons. It tried to add using jquery but it is not working for me.
function lighttheme() {
$('#twitterfeeds').attr('data-theme', 'light');
$('#twitterfeeds').prop('data-theme', 'light');
}
function darktheme() {
$('#twitterfeeds').attr('data-theme', 'dark');
$('#twitterfeeds').prop('data-theme', 'dark');
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="text-center pb-2">
<button class="btn btn-dark" onclick="darktheme()">Dark</button>
<button class="btn btn-light" onclick="lighttheme()">Light</button>
</div>
<div>
<a class="twitter-timeline twitterfeeds" data-theme="dark" id="twitterfeeds" href="https://twitter.com/ForexLive?ref_src=twsrc%5Etfw">Tweets by ForexLive</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
thanks in advance.