I have this piece of js code allowing me, on a <select>
change, change the table theme color.
How can I execute this jQuery when the page loads and when a <option>
of <select>
is already selected ?
Thanks.
My HTML:
<select name="HOT_ColorsTheme" id="HOT_ColorsTheme" class="form-control">
<option value="A">Thème A</option>
<option value="B" selected>Thème B</option>
</select>
My JS:
<script>
$("#HOT_ColorsTheme").on('change', function() {
var sel = $('#HOT_ColorsTheme').val();
if (sel=='A') {
$(".Today").css({'background' : '#fe0002', 'color' : '#000000'});
}
if (sel=='B') {
$(".Today").css({'background' : '#dedede', 'color' : '#000000'});
}
});
</script>