I've got this code here now, but the alerts still come up after you click on the input, when it doesn't have focus. I would like to get rid of the click function too, if possible, so that it only alerts when the input has focus.
$('#inputSize').click(function(){
if ($('#inputSize').is(':focus')){
$(document).keydown(function(e){
if (e.keyCode == 38) {
alert( "up pressed" );
return false;
}
if (e.keyCode == 40) {
alert( "down pressed" );
return false;
}
});
}
});
Thanks!