Jump to content

getting the value of an input that is partially filled with predictive text


reveret
 Share

Recommended Posts

I have searched in vain for an answer to this problem, but I am getting no where.  Here is the issue:  I have a search form that works fine as a desktop application.  On mobile devices there is a problem.  If a user starts typing in the search input, and then taps one of the words that pops up in predictive text (such as on an iphone), this word then fills the input.  The search form returns no matches because, as I have discovered, the only thing being submitted is what the user actually typed before tapping the predictive hint.  For example, if they start typing Pennsylvania but only type "Pennsy" and then tap the suggestion, the only value in the input is "Pennsy," not the whole word.

I have seen some suggestions:  for example, setting the input type to 'password' prevents predictive suggestions (and thus requiring the user to type out the entire term), but this also triggers hiding the text submitted (as if it were a password). I have also seen some suggest that you could use setTimeout() before ajax submits the form to the server, but this did not work either and I am not quite sure of the logic behind this solution anyway.

Is there a way for javascript / jquery to "read" the value of an input that the user filled by means of tapping predictive text?

Thanks in advance'

reveret  

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...