Hi,
I am trying to make a form to run a function on keyup, keydown.
The markup is:
<select id="family">
<option value="Georgia" label="Georgia">Georgia</option>
<option value="Times New Roman" label="Times New Roman">Times New
Roman</option>
<option value="HelveticaNeue-Light" label="Helvetica Neue
Light">Helvetica Neue Light</option>
</select>
I made a function that change the font-family on click:
<script type="text/javascript">
$(document).ready(function(){
$('#family').click(function() {
value = $(this).val();
$('.cica').css('font-family', value)
});
});
//capture the down key
$("#family").bind("keydown", function(e) {
if (e.keyCode == 40) {
value = $(this).val();
$('#family').css('font-family', value)
return false; //prevent default behavior
}
});
</script>
I am trying to bind a keydown to this form so when I press Down key
the form change its value and execute the function - change the font-
family.
It looks that my bind keydown does nothing. What should I change here?
Thank you.