Saturday, March 30, 2013

How to create place holder using image with Css

<div>
<input type='text' name='Email' id='Email' class="email-wmark" />
</div>

<div>
<input type='password' name='Password' id='Email' class="pass-wmark" />
</div>


$(function () {
$('#Email').focus(function () {
            $(this).removeClass('email-wmark');
       });

       $('#Email').blur(function () {
            if ($(this).val() == '') {
                $(this).toggleClass('email-wmark');
              };
        });

        $('#Password').focus(function () {
            $(this).removeClass('pass-wmark');
        });

        $('#Password').blur(function () {
            if ($(this).val() == '') {
                $(this).toggleClass(' pass-wmark');
            };
        });
    });


.email-wmark{background:#fff url(email-wmark.png) no-repeat 5px center !important;}
.pass-wmark{background:#fff url(pass-wmark.png) no-repeat 5px center !important;}
 

No comments:

Post a Comment