I'm having trouble coding a feature that changes the text size dynamically with a slider, and it's not working as expected.
$('input').on('change', function() {
var textSize = $(this).val();
$('.userText p').css('font-size', textSize + 'em')
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="range" min="1.2" max="2.6" step=".2" id="slider" />
<div class="userText">
<p>Some text that should dynamically change size</p>
</div>
Any advice or suggestions would be greatly appreciated!