Looking for a way to dynamically change textareas based on selections made in dropdown menus? Check out this JavaScript code snippet: http://jsfiddle.net/73udajhm/
The following is the JavaScript used:
$(function () {
$("#fontsize").on('change', function () {
$('.address').css('font-size', $(this).val() + 'px');
});
});
$(function () {
$("#fonttype").on('change', function () {
$('.address').css('font-family', $(this).val());
});
});
$(function () {
$("#fontweight").on('change', function () {
$('.address').css('font-weight', $(this).val());
});
});
This is the HTML part of the code:
Font Size:
<select id="fontsize">
<option>-</option>
<option value="24">24</option>
<option value="16">16</option>
</select>
<br />Font Type:
<select name="fonttype">
<option>-</option>
<option value="verdana">Verdana</option>
<option value="arial">Arial</option>
</select>
<br />Font Weight:
<select id="fontweight">
<option>-</option>
<option value="bold">Bold</option>
<option value="regular">Regular</option>
</select>
<div>
<textarea id="label" class='address'>Hello 123</textarea>
<textarea class='address'>Hello 123</textarea>
</div>