p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Javascript How-To (http://p2p.wrox.com/forumdisplay.php?f=87)
-   -   How to insert default value if text box is empty (http://p2p.wrox.com/showthread.php?t=5900)

akc November 7th, 2003 11:13 AM

How to insert default value if text box is empty
 
Hi,

I have a form and I want to insert a default value into a text box if it is empty. Thanks in advance.

Alan

planoie November 7th, 2003 11:23 AM

<script>
function setDefaults(){
    if(document.form.myTextBox.value==""){
        document.form.myTextBox.value = "default value";
    }
}
</script>

<body onLoad="setDefaults();">

Peter
------------------------------------------------------
Work smarter, not harder.

akc November 7th, 2003 11:55 AM

Thanks Peter!

Alan



All times are GMT -4. The time now is 03:27 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.