Support » Plugin: Gravity Forms - Placeholders add-on » Text disappears on click into the field

Viewing 2 replies - 1 through 2 (of 2 total)
  • behladesign and anyone else,

    I got this functionality working. Change the .each(function() in gf.placeholders.js to this:

    .each(function(){
    			var $field = $(this);
    
    			var id = this.id;
    			var $labels = $('label[for=' + id + ']').hide();
    			var label = $labels.last().text();
    
    			if (label.length > 0 && label[ label.length-1 ] == '*') {
    				label = label.substring(0, label.length-1) + ' *';
    			}
    
    			$field[0].setAttribute('placeholder', label);
    
    			$(this).focus(
    			    function(){
    			       $field[0].setAttribute('placeholder', '');
    			    });
    			$(this).blur(
    			    function(){
    			       $field[0].setAttribute('placeholder', label);
    			    });			
    
    		});

    Thanks steedancrowe!
    That helped.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Text disappears on click into the field’ is closed to new replies.