/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(function() { $("#emaillist input[type='text']").attr( 'value', 'enter email' ); $("#emaillist input[type='text']").focus(function () { var value = $("#emaillist input[type='text']").attr( 'value'); if (value == 'enter email'){ $(this).addClass('black'); $("#emaillist input[type='text']").attr( 'value', '' ); } }); $("#emaillist input[type='text']").focusout(function () { var value = $("#emaillist input[type='text']").attr( 'value'); if (value == '' || value == 'enter email'){ $(this).removeClass('black'); $("#emaillist input[type='text']").attr( 'value', 'enter email' ); } }); });
Comments
