i was looking for answer on stackoverflow but didn't found it. i'm creating a color switcher
i have a default path <script src="js/theme/theme-default.js"></script> which is working fine on my website
i also created color switcher code
My HTML
<a href="#" data-style="theme-blue" title="blue: #3498DB" style="background: #3498DB">
</a>
My JS
$('.color-changer a').on('click', function(){
var style = $(this).attr('data-style');
$('#themeJS').attr('src', 'js/theme/' + style + '.js');
return false;
})
lets assume if i click on the first color, the path would be changed
to
<script src="js/theme/theme-blue.js"></script>
it's changing the path if i inspect but it's not giving me the effects which i want from theme-blue.js
the js files theme-default.js and theme-blue.js
( theme-default.js )
$('body').css({
'background-color':'#eee'
});
( theme-blue.js )
$('body').css({
'background-color':'#3498db'
});
i want to fix this thing with JS
