here is what iam trying to do.
there is a textfield. which has a watermark in it(js code). so it will say "Enter Username". so user will enter username in it but if somethig go wrong than it should save the value in textfield(php code).
<input type="text" name="username" id="login_username" class="field" value="<?php if(isset($_POST['username'])){echo htmlentities($_POST['username']);}?>" />
the poblem is that its interfering this code below. what this code does is create watermark into field.
var username = 'Enter Username';
$('#login_username').css('color', 'gray');
$('#login_username').attr('value', username).focusin(function()
{
$(this).css('color', 'black');
if($(this).val() == username)
{
$(this).attr('value', '');
}
}).focusout(function()
{
if($(this).val() == '')
{
$(this).css('color', 'gray');
$(this).attr('value', username);
}
});
right now what it does is js code over rides php code. and it only display watermark. but if i remove js code that php code work fine.
is there a way to combine those two scripts?
look at hotmail.com login page. that is what iam trying to do. there is a watermar in textfield but if you enter some thing in it, than it save the value.