I want the cursor to be in a particular textbox when the page loads. I achieved it using document.formname.formname.focus()
But the textbox has a default text. And i want it to disappear once the user starts typing. how can i get rid of this default test ?
Jayakrishnan_gk
0
Newbie Poster
Recommended Answers
Jump to PostAdd this code to the head of your document (Or in an external file if you use one)
<script type="text/JavaScript"> function checkValue() { if(document.getElementById('my_field').value == "default_value") { document.getElementById('my_field').value = ""; } } </script>
Change my_field and default_value to the relevant values for your script.
Then add …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.