I'm having trouble changing the font-family using the code below, even though the color is changing properly. What am I missing here and how can I correct it?
$(document).ready(function(){
$("body").on("click",".selectableColor", function(){
var tColor = $(this).attr("data-color");
$('.change').css('color','#'+tColor+'');
});
$("body").on("click",".fontBox", function(){
var tStyle = $(this).attr("data-style");
$('.change').css('font-family', tStyle);
});
});
HTML
<div class="change_area_header" style="overflow: hidden; outline: currentcolor none medium;" tabindex="2">
<div class="selectableColor" style="background-color:#ffebee" data-color="ffebee"></div>
<div class="selectableColor" style="background-color:#ffcdd2" data-color="ffcdd2"></div>
</div>
<!--Font Family-->
<div class="change_area_header" style="overflow: hidden; outline: currentcolor none medium;" tabindex="4">
<div class="fontBox" style="font-family: 'Montserrat', sans-serif;" data-style="'Montserrat', sans-serif;">MontSerrat</div>
<div class="fontBox" style="font-family: 'Aleo', serif;" data-style="'Aleo', serif;">Aleo</div>
<div class="fontBox" style="font-family: 'Raleway', sans-serif;" data-style="'Raleway', sans-serif;">Raleway</div>
</div>
Check out the demo on codepen.io