
Originally Posted by
paul_wilkins
More info required.
What do you want to be done instead?
Do you want the text to be removed while the field is active?
Do you want the insertion bar to be placed at the end of the text?
Do you want the insertion bar at the start of the text?
Do you want the field itself to be disabled?
Dear Paul,
Q1: No.
Q2: Yes.
Q3: No.
Q4: No.
What I want is what you get on a focus by mouse.
And if you don't mind let's consider the following form:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>
<script>
$(document).ready(function(){
$("#site").focus(function(){
if( this.value == this.defaultValue ) {
$(this).val("http://");
}
});
});
</script>
</head>
<body>
<form action="#" method="post">
<input type="text" id="name" /><br />
<input type="text" id="site" value="Website" /><br />
<input type="submit" value="Send">
</form>
</body>
</html>
Bookmarks