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:

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>";
}
Chinh Do

I occasionally blog about programming (.NET, Node.js, Java, PowerShell, React, Angular, JavaScript, etc), gadgets, etc. Follow me on Twitter for tips on those same topics. You can also find me on GitHub. See About for more info.

View Comments

  • 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

  • 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

Recent Posts

How to switch to a different Kubernetes context or namespace?

To list available contexts: kubectl config get-contexts To show the current context: kubectl config current-context…

2 years ago

How to ssh into Kubernetes pod

kubectl exec -it <podname> -- sh To get a list of running pods in the…

2 years ago

How to Create a Soft Symbolic Link (symlink) in Unix/Linux

# Create a soft symbolic link from /mnt/original (file or folder) to ~/link ln -s…

3 years ago

How to Configure Git Username and Email Address

git config --global user.name "<your name>" git config --global user.email "<youremail@somewhere.com>" Related Commands Show current…

3 years ago

Getting the Last Monday for Any Month with TypeScript/JavaScript

TypeScript/JavaScript function getLastMonday(d: Date) { let d1 = new Date(d.getFullYear(), d.getMonth() + 1, 0); let…

4 years ago

How to View Raw SMTP Email Headers in Outlook

I had to do some SMTP relay troubleshooting and it wasn't obvious how to view…

5 years ago