1

Is it possible to use the library with an input text box? I have tried but it doesn't work! For example:

<input type="text" id="textId"/>
(....)
var auto = completely(document.getElementById('textId')........

Regards.

2 Answers2

1

you have to change your code to be like this:

HTML

<div id="textId"></div>

JAVASCRIPT CODE

var auto = completely(document.getElementById('textId'));

...then it will work

Zo72
  • 14,593
  • 17
  • 71
  • 103
  • I think because your answer is not relevant as OP asked how to make `input`tag works with complete.ly. But nice answer anyway because I did not know that complete.ly only works with `div` – phuwin Jan 04 '16 at 09:32
0
   auto.onChange = function setFiller(){
      auto.repaint();
      if(document.getElementById("Requestor")){
         document.getElementById("Requestor").value=auto.getText();
      }
   }

You could add this (in the tags at the end of the section you added into the body of your page). It still allows for the default use of the repaint function that is defaulted for the onChange function and then fills the input element (probably type=hidden within the page's form) with the current text.. ('auto' is the completely var) ("Requestor" is the id of the input element.)

sdmonkey
  • 1
  • 1