Bug Tracker

Modify

Ticket #9223 (closed bug: worksforme)

Opened 3 years ago

Last modified 3 years ago

Live blur focus

Reported by: bdmc@… Owned by:
Priority: low Milestone: 1.next
Component: event Version: 1.6
Keywords: Cc:
Blocking: Blocked by:

Description

I cannot get the following script to work. The 'focus' function works, but the 'blur' function does not. I tried to run it with JsFiddle but to no avail.

Here is the script

function initiateFieldLabels(){
	$("input.default").live({
  		focus: function() {
			var value =$(this).val();
			if(!$('#'+$(this).attr('id')+'-default').length){
				$(this).after('<input type=\"hidden\" id=\"'+$(this).attr('id')+'-default\" value=\"'+value+'\" />');	
			}
			$(this).val('');
			$(this).removeClass('default')
  		},
 		blur: function() {
			alert('hello');
			var value = $('#'+$(this).attr('id')+'-default').val();
			$(this).val(value);
			$(this).addClass('default');
  		}
	});
}

Change History

comment:1 in reply to: ↑ description Changed 3 years ago by Benji6996

Here is an example:

 http://jsfiddle.net/2Uq65/1/

comment:2 Changed 3 years ago by timmywil

  • Priority changed from undecided to low
  • Resolution set to worksforme
  • Status changed from new to closed
  • Component changed from unfiled to event

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.