ted_chou12 Posted December 17, 2008 Share Posted December 17, 2008 Hello, is there a way to detect if something has been inputed into the input text box? I dont mean after clicking the submit button, I want the detection to be ongoing, immediately after entering a string, the detection will catch it, Thanks, Ted Quote Link to comment https://forums.phpfreaks.com/topic/137275-solved-detect-input-text/ Share on other sites More sharing options...
webster08 Posted December 17, 2008 Share Posted December 17, 2008 create a function to check the input box value's length and add the function to a onkeyup() event in the input box. Quote Link to comment https://forums.phpfreaks.com/topic/137275-solved-detect-input-text/#findComment-717248 Share on other sites More sharing options...
ted_chou12 Posted December 17, 2008 Author Share Posted December 17, 2008 Thanks, this is what I got so far, but i cant get it to work: <script type="text/javascript"> function check(what) { var length=what.nickname.value.length; if (length > 1) document.getElementById("myButton1").value="New Button Text"; } </script> <form id="myform" method="post" action="" enctype="multipart/form-data"> <input type="button" value="Button Text" id="myButton1"></input> <input type="text" id="tfield" value="" size="50" maxlength="300" onkeyup="check(this.id)" /> </form> Ted Quote Link to comment https://forums.phpfreaks.com/topic/137275-solved-detect-input-text/#findComment-717254 Share on other sites More sharing options...
webster08 Posted December 17, 2008 Share Posted December 17, 2008 do it like this: <script type="text/javascript"> function check(what) { var length=document.getElementById(what).value.length; if (length > 1) document.getElementById("myButton1").value="New Button Text"; } </script> <form id="myform" method="post" action="" enctype="multipart/form-data"> <input type="button" value="Button Text" id="myButton1"></input> <input type="text" id="tfield" value="" size="50" maxlength="300" /> </form> Quote Link to comment https://forums.phpfreaks.com/topic/137275-solved-detect-input-text/#findComment-717257 Share on other sites More sharing options...
ted_chou12 Posted December 17, 2008 Author Share Posted December 17, 2008 Thank you that worked well Quote Link to comment https://forums.phpfreaks.com/topic/137275-solved-detect-input-text/#findComment-717263 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.