Jquery Autocomplete with Jade/Pug

廉价感情. 提交于 2019-12-02 10:58:59

After did some research, test, trial and error. In fact the code have to put after the tag of body. So it must be like :

</body>

script(src='/demo/jquery.js', type='text/javascript')
link(rel='stylesheet', href='/autocomplete.css')
script(src='/autocomplete.js', type='text/javascript')
script.
  var states = [
  'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',
  'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii',
  'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana',
  'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',
  'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire',
  'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota',
  'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island',
  'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont',
  'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'
  ];
  $('#auto1').autocomplete({
  source:[states]
  });

Finally, everything goes well. I hope this helps. Please refer to this documentation of jquery autocomplete by xdsoft,

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!