jquery in sharepoint 2013 web part -
i trying add jquery sharepoint 2013 visual webpart. have put script files in layouts folder , able reference them in ascx, not recognizing jquery syntax.
<script src="../_layouts/15/jquery-2.1.0.min.js"></script> <script src="../_layouts/15/jquery-ui-1.10.4.min.js"></script> <script> $(function () { $("#accordian").accordion(); });//not recognized </script> any advice appreciated.
thanks
edit
when try running it, error: 'jquery' undefined. when debug, in ui script file, looks loading jquery-ui not main jquery script. (maybe?)
edit
actual problem turned out jquery file malformed. @moderator - please delete
you might want put jquery files in specific folder in layouts not clutter layouts directory.
and can reference jquery files this:
<sharepoint:scriptlink id="jquery" runat="server" name="mywebpart/jquery-2.1.0.min.js" language="javascript" /> <sharepoint:scriptlink id="jqueryui" runat="server" name="mywebpart/jquery-ui-1.10.4.min.js" language="javascript" /> and files sitting in following location on server:
c:\program files\common files\microsoft shared\web server extensions\15\template\layouts\mywebpart\jquery-2.1.0.min.js
c:\program files\common files\microsoft shared\web server extensions\15\template\layouts\mywebpart\jquery-ui-1.10.4.min.js
Comments
Post a Comment