开发者

Unobtrusive jquery with autocomplete on rails

C开发者_开发问答an we use unobtrusive javascript to implement features like autocomplete in jquery? or should I use the public/javscripts folder and reference each javascript that interests one of my views separately?

Please advise


Yup you can use autocomplete plugins from jquery or you can build your own. More info on your problem could get a better answer, but for now, the straight answer to your question is, yes you can use autocomplete and jquery. And yes you should put all your scripts in your public/javascripts folder.

Unobtrusive JS basically means your scripts aren't found in your html. So you can just create a file like autocomplete.js in your public/javascripts folder then include it in your HTML like so:

<%= javascript_include_tag "autocomplete" %>

that's as unobstrusive as you can be

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜