Problem with jqModal/jQuery JavaScript Intellisense and Workaround

Is anyone else experiencing a problem with Visual Studio 2008 Intellisense with jQuery and jqModal?

It seems that jqModal (a jQuery plugin for modal dialogs) is breaking jQuery Intellisense on my Visual Studio 2008 setup. Without a reference to jqModal.js, jQuery Intellisense works fine:

image

As soon as I add the reference to jqModal.js, the Intellisense stops working with this error:

Warning    1    Error updating JScript IntelliSense: …\scripts\jquery-1.3.2-vsdoc.js: ‘jQuery.support.htmlSerialize’ is null or not an object @ 1430:4

Workaround

To work around the problem, generate the script include tag dynamically so that the JavaScript Intellisense engine doesn’t see the jqModal reference at design time.

<head runat="server">
    <title>My Web</title>
    <asp:Literal ID="LitJqModalScript" runat="server"></asp:Literal>
    <script src="../scripts/jquery-1.3.2.js" type="text/javascript"></script>
</head>

 

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
 
    LitJqModalScript.Text = @"<script src=""../scripts/jqModal.js"" type=""text/javascript""></script>";
}

5 Replies to “Problem with jqModal/jQuery JavaScript Intellisense and Workaround”

  1. I had the same problem but in a MVC project, what I’ve done is that a I created a HtmlHelper extension that renders, something like this:

    public static string IncludeJavaScriptFile(this HtmlHelper helper, string fileName)
    {
    return string.Format(“”, fileName);
    }

    Then I included my scripts in my masterpage with this, and for intellisense support I added the vsdoc file in my master like this:

    And now it works perfectly

  2. I really needed this debugged and didn’t like the workarounds. So I fixed the code:

    change the following line near the end of the function:
    i = $(”).css({ opacity: 0 }),

    TO:

    i = $(”).addClass(‘jqm’).attr(‘src’, “javascript:false;document.write(\’\’);”).css({ opacity: 0 }),

    Intellisense will now work as well as jqModal.

    Tim

Leave a Reply

Your email address will not be published. Required fields are marked *