JP128 Posted February 11, 2007 Share Posted February 11, 2007 <script language="javascript"> function clearData(fieldName){ document.form1.fieldName.value=""; } </script> How would I go about this? I want to be able to create an input field, with onClick="clearData('username');"... I have tried: document.form1.fieldName.value=""; document.form1.'fieldName'.value=""; document.form1.+fieldName+.value=""; document.form1.+ "fieldName" +.value=""; Link to comment https://forums.phpfreaks.com/topic/37989-documentform-value-returns-an-error/ Share on other sites More sharing options...
JP128 Posted February 11, 2007 Author Share Posted February 11, 2007 <script language="javascript"> function clearData(field){ document.getElementById(field).value=""; } </script> thats what I used... Link to comment https://forums.phpfreaks.com/topic/37989-documentform-value-returns-an-error/#findComment-181799 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.