unemployment Posted June 1, 2011 Share Posted June 1, 2011 How can I clear an input field value using an onclick event on a different element? link.onclick = function(){ input = ''; } This fails. Quote Link to comment https://forums.phpfreaks.com/topic/238149-clear-input-field-value/ Share on other sites More sharing options...
KevinM1 Posted June 1, 2011 Share Posted June 1, 2011 Try one of: link.onclick = function(){ input.value = ''; } or link.onclick = function(){ input.innerHTML = ''; } Quote Link to comment https://forums.phpfreaks.com/topic/238149-clear-input-field-value/#findComment-1223779 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.