Revision: 51654
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 30, 2011 22:44 by tjboverl
Initial Code
<script type="text/javascript"> $(document).ready(function(){ $('.inputfield').each(function(){ $(this).val(''); add_placeholder($(this)); }) $('.inputfield').focus(function(){ remove_placeholder($(this)); }).blur(function(){ add_placeholder($(this)); }).blur(); }); function add_placeholder(field) { var placeholder = field.attr('name'); if(field.val() == '') { field.val(placeholder); field.addClass('placeholder'); } } function remove_placeholder(field) { var placeholder = field.attr('name'); if(field.val() == placeholder) { field.val(''); field.removeClass('placeholder'); } } </script>
Initial URL
Initial Description
Initial Title
placeholders using jQuery
Initial Tags
jquery, CSS3
Initial Language
jQuery