Jump to content

Autofill Textfield


Canman2005

Recommended Posts

Hi all

 

I am wondering if anyone knows if a script exists to do the following.

 

What I need is 2 html text form fields, when you enter text into one of the text fields, it would automatically update the other form field with the first letter of what was typed.

 

So for example, if you have the 2 form fields and you enter

 

Google

 

into the field, then it would automatically enter G into the other text field.

 

Does anyone know if this exists?

 

Thanks

Dave

Link to comment
https://forums.phpfreaks.com/topic/106287-autofill-textfield/
Share on other sites

here is a start for you

<script>
function setInput(passedValue){
document.getElementById('input2').value=passedValue;
}
</script>
<form>
<input onkeyup="setInput(this.value)" type="text" id="input1" />
<input type="text" id="input2" />
</form>

Link to comment
https://forums.phpfreaks.com/topic/106287-autofill-textfield/#findComment-544757
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.