Created
August 3, 2010 14:43
-
-
Save patrys/506492 to your computer and use it in GitHub Desktop.
Revisions
-
patrys revised this gist
Aug 16, 2010 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,9 +20,9 @@ $(function() { setPlaceholder(); fld.focus(removePlaceholder); fld.blur(setPlaceholder); fld.parents("form").submit(removePlaceholder); }); } }); -
patrys revised this gist
Aug 16, 2010 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,9 +20,9 @@ $(function() { setPlaceholder(); $(this).focus(removePlaceholder); $(this).blur(setPlaceholder); $(this).parents("form").submit(removePlaceholder); }); } }); -
patrys revised this gist
Aug 3, 2010 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,14 +5,14 @@ $(function() { var fld = $(this); function setPlaceholder() { if (fld.val() == text || fld.val() == '') { fld.addClass('jqPlaceholder'); fld.val(text); } } function removePlaceholder() { if (fld.val() == text || fld.val() == '') { fld.val(''); fld.removeClass('jqPlaceholder'); } -
patrys revised this gist
Aug 3, 2010 . 1 changed file with 20 additions and 28 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,36 +1,28 @@ $(function() { if (!('placeholder' in document.createElement('input'))) { $('input[placeholder], textarea[placeholder]').each(function() { var text = this.getAttribute('placeholder'); var fld = $(this); function setPlaceholder() { if (fld.value == text || fld.value == '') { fld.addClass('jqPlaceholder'); fld.val(text); } } function removePlaceholder() { if (fld.value == text || fld.value == '') { fld.val(''); fld.removeClass('jqPlaceholder'); } } setPlaceholder(); $(this).focus(removePlacholder); $(this).blur(setPlaceholder); $(this).parents("form").submit(removePlacholder); }); } }); -
patrys created this gist
Aug 3, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ $(function(){ if (!("placeholder" in document.createElement("input"))) { $('input[placeholder], textarea[placeholder]').each(function() { var text = this.getAttribute('placeholder'); var fld_current = this; if (this.value == '' || this.value == text) { $(this).addClass('jqPlaceholder'); this.value = text; } $(this).focus(function() { if(this.value == text || this.value == '') { this.value = ''; $(this).removeClass('jqPlaceholder'); }; }); $(this).blur(function() { if(this.value == text || this.value == '') { $(this).addClass('jqPlaceholder'); this.value = text; }; }); $(this).parents("form").each(function() { $(this).submit(function() { if(fld_current.value == text) { fld_current.value = ''; } }); }); }); } });