Jquery Autocomplete with Jade/Pug

后端 未结 1 851
谎友^
谎友^ 2021-01-27 16:57

i need help for this case, about to implement Jquery Autocomplete in Jade/Pug. The result of autocomplete doesnt display in form, although there are now error shown.

1条回答
  •  温柔的废话
    2021-01-27 17:45

    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 :

    
    
    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,

    0 讨论(0)
提交回复
热议问题