Using JQuery in a Subfolder When the MasterPage is in the Root Folder

佐手、 提交于 2019-12-04 08:49:13

simply use this:

<script src="/js/jquery.js" type="text/javascript"></script>

putting / before js do the trick. I always keep my css and javascript files in separate folders and use this tweak to rightly include them.

for intellisense you can try this trick:

<%if(true){%>
    <script src="/js/jquery.js" type="text/javascript"></script>
<%}%>

I'm not able to recall the source of this trick.

You could use a script manager to include the JS files:

<asp:ScriptManager runat="server">
    <Scripts>
        <asp:ScriptReference Path="~/js/jquery.js" />
    </Scripts>
</asp:ScriptManager>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!