So it looks like you're trying to fade in "#europe" as someone types
into the input. The opacity value should go from 0 to 1, though, so
I'm not sure why the values above 1 are there. Also, I would think
you'd want to set the initial state based on the input field. If all
of that is true, something this simple could replace all that code.

$("#myInput").keyup(function() {
  $("#europe").css("opacity",
     Math.max(0.05, Math.min(1, this.value.length/14)));
}).trigger("keyup");

Reply via email to