1

Thank in advance i am new in programming.right now i am working on a portal which has a form containing text box.i want to search the city name as per the keyword entered by user and display the result below the text box in div which remain hide when text box is empty . my form and throughout PHP code working nice and showing the most matched city name as per the keyword entered by the user. but the major problem is when user enter keyword before and when result appear browser automatically shows the city name which i have entered in previous attempt. now can any one suggest me any solution so,to prevent browser from showing the default city name.

  • 2
    possible duplicate of [Is it possible to disable autocomplete?](http://stackoverflow.com/questions/3730601/is-it-possible-to-disable-autocomplete) – Jukka K. Korpela Aug 16 '12 at 13:03
  • what javascript framework do you use? – Mihai Iorga Aug 16 '12 at 13:03
  • See http://stackoverflow.com/questions/2530/how-do-you-disable-browser-autocomplete-on-web-form-field-input-tag. I think this is a duplicate of that question. – trebormf Aug 16 '12 at 13:04

1 Answers1

2

Hi there i also faced same problem in my old project.

Then i have try many solution, but the best solution i have got and which really worked for me, and i have used that in my many projects. I used the autocomplete attribute for the text box...

<input type="text" name="" id="" autocomplete="off" />

and solved the problem hopefully it would work for you also

Dan McClain
  • 11,780
  • 9
  • 47
  • 67
vivek salve
  • 991
  • 1
  • 9
  • 20
  • This is the standard and is the right thing to but, now the issue is that mainly on Samsung devices that have custom browser (not Android one) this will not work. In my case I even added: `autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"` and for some devices this doesn't have any effect – pauldcomanici Mar 06 '14 at 10:43