Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am making an visual webpart in Sharepoint 2010, and I am trying to load my jquery files in the ascx page.

Near the top of the page I have this:

<SharePoint:CssRegistration ID="jquery_css" name="/_layouts/PDF Library/blitzer/jquery-ui-1.10.3.custom.min.css" runat="server" EnableCssTheming="true" after="true" />
<SharePoint:ScriptLink ID="jquery_js" name="/_layouts/PDF Library/jquery-2.0.0.min.js" runat="server" OnDemand="False" Localizable="False" />
<SharePoint:ScriptLink ID="jquery_ui_js" name="/_layouts/PDF Library/jquery-ui-1.10.3.custom.min.js" runat="server" OnDemand="False" Localizable="False" />

And near the middle of the page I have this:

            <asp:Panel id="help_panel" runat="server">
                Click <a href="#" onclick="$(this).next().slideDown();" title="Click to show details">here</a>.
                <div style="display:none">
                    <ol>
                        <li>1</li>
                        <li>2</li>
                        <li>3</li>
                        <a href="#" onclick="$(this).parent().parent().hide();" title="Click to hide details">Hide Details</a>
                    </ol>
                </div>
                <br/>
            </asp:Panel>

When the asp.net page loads in IE9, and when I click the link to display the div tag, it does not work, the error message was The value of the property '$' is null or undefined, not a Function object.

However if I check the developer tools, I see that the jquery and css files are there. Yet the link doesn't work. Maybe the files are being loaded after the link gets processed?

Does anyone know how to fix this?

It works in Firefox 21 beta, but I want it to work in IE9.

Thanks.

share|improve this question
    
do you mean adding the jquery ref to an application page? –  Falak Mahmood May 8 '13 at 18:14
    
I updated my original post. But its a visual webpart, and I am adding this code in the ascx page. –  omega May 8 '13 at 18:19

1 Answer 1

up vote 3 down vote accepted

The problem is likely because you are using jQuery 2.0 which does not have support for IE 6/7/8 or IE 9/10 when running in compatibility mode (which I'm guessing SP 2010 is using. You can confirm this by using the F12 developer tools).

I would recommend using jQuery 1.9.1 for use with SharePoint and so you still have support for the older browsers.

share|improve this answer
    
Oh now I see, that was the problem. Ok I will have to stick with 1.9.1 then. Thanks. –  omega May 8 '13 at 18:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.