1

I'm using complete.ly for a site intended for use on a touchscreen. The keyboard only appears on-screen if the selected element is a textfield or input, the code for that is:

if( (this.input_target.is('input') || this.input_target.is('textarea')) && this.input_target.parent().find('.popover').length == 0)

Is there anyway you guys can think of that I can either change the keyboard logic to include the div that complete.ly is using, or maybe change complete.ly to make this work?

I guess a better way for me to ask this would be if there is any way to detect when complete.ly's text box has focus.

BammaHamma
  • 459
  • 4
  • 11

1 Answers1

1

I am not sure I understand the original question but I do understand your last comment:

I guess a better way for me to ask this would be if there is any way to detect when complete.ly's text box has focus.

well, there is a way to see when completely's text box (input type) has focus.

if you look at the documentation it says:

// For no-big-deal hacking
c.wrapper
c.prompt
c.input
c.hint
c.dropDown

so you can access the input and do something like this:

if (c.input.addEventListener) {
    _c.input.addEventListener("focus", yourHandlerFunction, false);
}
else {
    _c.input.attachEvent("onfocus",  yourHandlerFunction);
}
Zo72
  • 14,593
  • 17
  • 71
  • 103
  • That looks pretty close to what I need. I'm not sure how I would go about using that to return a boolean true if it has focus, though, which is exactly what I need. Would it be as simple as saying something like if(c.input.onfocus){something} ? – BammaHamma Jul 09 '14 at 21:32
  • @BammaHamma No. listen to both focus and blur events. and set a flag. if you get a blur event you have lost focus ... if you get a focus event you have gained focus... – Zo72 Jul 09 '14 at 21:44
  • I see. I'm about to get off work, but I'll try it tomorrow and see if it works. Thank you very much, Zo, for your patience with a poor nub. – BammaHamma Jul 09 '14 at 21:46