erang placeholder js

This commit is contained in:
sanj 2010-08-30 00:11:18 +05:30
parent 1353fc4fbb
commit eab5b07dc4

View File

@ -7,8 +7,8 @@ $(document).ready(function() {
$('input, textarea').each(function() {
var hasPlaceholder = $(this).attr("data-placeholder") == undefined ? false : true;
if (hasPlaceholder) {
var placeholderText = $(this).data("placeholder") = $(this).attr("data-placeholder");
$(this).addClass("placeholder").val(placeholderText);
$(this).data("placeholder") = $(this).attr("data-placeholder");
$(this).addClass("placeholder").val($(this).data("placeholder"));
$(this).focus(function() {
var currText = $(this).val();
if (currText == $(this).data("placeholder")) {