1 Replies - 244 Views - Last Post: 29 June 2012 - 05:52 PM

#1 nick2price  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 559
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

key up to onblur

Posted 29 June 2012 - 03:23 PM

Hi guys, the following works perfectly
$(document).ready(function() {
		
		$("#depart").keyup(function(){
		
			var to = $("input[name='depart']").val();
		
			if(to != 0)
			{
				$("#toAirport").css({
					"background-image": "url('http://www.test.com/tick.png')"
				});			
			} else {
				$("#toAirport").css({
					"background-image": "none"
				});			
			}
		
		});
});


The problem is, it displays the tick image to early (while the user is still typing). To delay it, I was going to change it to a blur event. Is there anyway I can create a blur event above without having to do anything to the form element?

Is This A Good Question/Topic? 0
  • +

Replies To: key up to onblur

#2 VolcomMky  Icon User is offline

  • D.I.C Regular

Reputation: 72
  • View blog
  • Posts: 291
  • Joined: 13-May 09

Re: key up to onblur

Posted 29 June 2012 - 05:52 PM

jQuery .blur()

Instead of
 $("#depart").keyup(function(){


Try
 $("#depart").blur(function(){

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1