Does anyone know how to allow this character countdown to be controlled by pre-determined variables that are linked to the select field options?
var large = 300
var medium = 200
var small = 100
I appreciate any input greatly.
Example Code:
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
function updateCountdown() {
var remaining = 50 - jQuery('#post').val().length;
jQuery('#character_limit').text(remaining + ' characters remaining.');
}
jQuery(document).ready(function($) {
updateCountdown();
$('#post').change(updateCountdown);
$('#post').keyup(updateCountdown);
});
</script>
<textarea id="post" cols="40" rows="3" maxlength="500"></textarea>
<div id="character_limit"></div>
<select name="product" id="product">
<option value="large">Large Product</option>
<option value="medium">Medium Product</option>
<option value="small">Small Product</option>
</select>