I want to have one input type textbox where I can observe the user's input while typing and provide him/her suggestion in listbox below the textbox. When user chooses that input by clicking on it, that text must be appended in main textbox. So far I achieved to write code to observe the typing (by using onchange javascript event) and provide suggestion on listbox. But I dont understand how to add the selected suggestion in main textbox with different font attributes. Is it achievable? any hint or plugin details most welcome.
adding the sample code. I hope it will give brief idea what I want to achieve.
<script>
function changeValue(){
var myval = document.getElementById("mytextbox").value;
var newval = "green text";
document.getElementById("mytextbox").value = myval + newval.fontcolor("green")";
}
</script>
<input type="textbox" id="mytextbox" value="small text " />
<input type="button" value="click me" onclick="changeValue()">
When button is clicked, the text in textbox should have appended green text and in green color. But it just shows on textbox as
"small text <font color="green">green text</font>"
Hope so it is achievable.