<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Guy Burstein : jQuery</title><link>http://blogs.msdn.com/bursteg/archive/tags/jQuery/default.aspx</link><description>Tags: jQuery</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Getting Started with jQuery in Visual Studio 2008</title><link>http://blogs.msdn.com/bursteg/archive/2009/06/05/getting-started-with-jquery-in-visual-studio-2008.aspx</link><pubDate>Fri, 05 Jun 2009 19:16:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9701557</guid><dc:creator>Guy Burstein</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/bursteg/comments/9701557.aspx</comments><wfw:commentRss>http://blogs.msdn.com/bursteg/commentrss.aspx?PostID=9701557</wfw:commentRss><wfw:comment>http://blogs.msdn.com/bursteg/rsscomments.aspx?PostID=9701557</wfw:comment><description>&lt;h1&gt;Getting Started with jQuery in Visual Studio 2008&lt;/h1&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="jQuery IntellSense in Visual Studio 2008" border="0" alt="jQuery IntellSense in Visual Studio 2008" align="right" src="http://blogs.msdn.com/blogfiles/bursteg/WindowsLiveWriter/GettingStartedwithjQueryinVisualStudio20_F0A6/jQuery_c4e63ba1-bcde-4f12-bfe7-1f9bdb19641a.png" width="230" height="80" /&gt;&lt;/p&gt;  &lt;p&gt;In this post I’ll talk about adding &lt;strong&gt;jQuery IntellSense in Visual Studio 2008&lt;/strong&gt;, and how to add jQuery to a simple Web Application inside Visual Studio 2008.&lt;/p&gt;  &lt;h3&gt;jQuery IntelliSense in Visual Studio 2008 - KB946581&lt;/h3&gt;  &lt;p&gt;In order to use &lt;strong&gt;jQuery&lt;/strong&gt; &lt;strong&gt;in Visual Studio 2008 with IntelliSence&lt;/strong&gt; a &lt;a href="http://blogs.msdn.com/webdevtools/archive/2008/02/09/downloadable-hotfix-performance-and-editor-fixes-for-microsoft-visual-studio-2008-and-visual-web-developer-express-2008.aspx"&gt;hotfix&lt;/a&gt; for Visual Studio 2008 must be installed:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;a href="https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=10826"&gt;Download the hotfix from Connect&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Run the executable and extract its contents to a folder in your hard drive. &lt;/li&gt;    &lt;li&gt;Make sure all instances of Visual Studio 2008 are closed, and run &lt;strong&gt;VS90-KB946581.exe&lt;/strong&gt; from the above folder. &lt;/li&gt; &lt;/ol&gt;  &lt;h3&gt;Download the Latest jQuery Library + Documentation&lt;/h3&gt;  &lt;p&gt;To use &lt;strong&gt;jQuery in Visual Studio 2008&lt;/strong&gt;, and enjoy its IntelliSense, you should download 2 javascript files. One contains the actual jQuery library, and the second contains the library with documentation for &lt;strong&gt;Visual Studio 2008&lt;/strong&gt; to display its &lt;strong&gt;IntelliSense&lt;/strong&gt;.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Go to &lt;a href="http://docs.jquery.com/Downloading_jQuery#Download_jQuery"&gt;jQuery Official Download Page&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Scroll down and find the &lt;strong&gt;Current Release&lt;/strong&gt; section. &lt;/li&gt;    &lt;li&gt;Download the &lt;strong&gt;Uncompressed&lt;/strong&gt; version (&lt;em&gt;jquery-1.2.6.js&lt;/em&gt;) and the documentation for Visual Studio (&lt;em&gt;jquery-1.2.6-vsdoc.js&lt;/em&gt;). &lt;/li&gt; &lt;/ol&gt;  &lt;h3&gt;Using jQuery in a Visual Studio 2008 Web Application&lt;/h3&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="jQuery IntelliSense in Visual Studio 2008 - KB946581" border="0" alt="jQuery IntelliSense in Visual Studio 2008 - KB946581" align="right" src="http://blogs.msdn.com/blogfiles/bursteg/WindowsLiveWriter/GettingStartedwithjQueryinVisualStudio20_F0A6/image_16d672f5-3fb2-4157-928c-7d8ab9ba564a.png" width="165" height="153" /&gt;In a new Web Application or inside an existing one, add the jQuery scripts into a certain folder.&lt;/p&gt;  &lt;p&gt;In a web page (or a master page), add a reference to the jQuery library:&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 11pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;head&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;title&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;jQuery Sample&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;title&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;strong&gt;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;script&lt;/span&gt; &lt;span style="color: red"&gt;src&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;scripts/jquery-1.2.6.js&amp;quot;&lt;/span&gt;         &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;script&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;head&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Then, in any javascript function you can start using &lt;strong&gt;jQuery&lt;/strong&gt; functions and enjoy the &lt;strong&gt;IntelliSense in Visual Studio 2008&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="jQuery IntelliSense in Visual Studio 2008 - KB946581" border="0" alt="jQuery IntelliSense in Visual Studio 2008 - KB946581" src="http://blogs.msdn.com/blogfiles/bursteg/WindowsLiveWriter/GettingStartedwithjQueryinVisualStudio20_F0A6/image_1e8bdb45-be2b-4e76-a8b9-5542092344d9.png" width="293" height="96" /&gt; &lt;/p&gt;  &lt;h3&gt;A Simple Example of Using jQuery Functions&lt;/h3&gt;  &lt;p&gt;For example, Assuming that you have a page with the following content in it:&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 11pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;form&lt;/span&gt; &lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;form1&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;input&lt;/span&gt; &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;text&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;inputs&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;txtName&amp;quot;&lt;/span&gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Enter Text Here&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;input&lt;/span&gt; &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;button&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;inputs&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;btnSubmit&amp;quot;&lt;/span&gt;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Click Me&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;&lt;strong&gt;onclick&lt;/strong&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&lt;strong&gt;=&amp;quot;handleButtonClick();&lt;/strong&gt;&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;form&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;This form contains a single textbox followed by a button.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="jQuery IntelliSense in Visual Studio 2008 - KB946581" border="0" alt="jQuery IntelliSense in Visual Studio 2008 - KB946581" src="http://blogs.msdn.com/blogfiles/bursteg/WindowsLiveWriter/GettingStartedwithjQueryinVisualStudio20_F0A6/image_4ee94ee5-29c9-4c96-8e69-9abfc7a2249e.png" width="242" height="39" /&gt; &lt;/p&gt;  &lt;p&gt;The &lt;em&gt;handleButtonClick()&lt;/em&gt; function handles the button &lt;em&gt;onclick&lt;/em&gt; event.&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 11pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;script&lt;/span&gt; &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160; &lt;span style="color: blue"&gt;function&lt;/span&gt; handleButtonClick() {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;script&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The way jQuery works is by selecting DOM elements and then doing something with them, such as executing a function or applying some properties. For example:&lt;/p&gt;  &lt;div style="font-family: consolas; background: white; color: black; font-size: 11pt"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;script&lt;/span&gt; &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160; &lt;span style="color: blue"&gt;function&lt;/span&gt; handleButtonClick() {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;strong&gt;$(&lt;span style="color: #a31515"&gt;&amp;quot;#txtName&amp;quot;&lt;/span&gt;).css(&lt;span style="color: #a31515"&gt;&amp;quot;border&amp;quot;&lt;/span&gt;, &lt;span style="color: #a31515"&gt;&amp;quot;solid 2px red&amp;quot;&lt;/span&gt;);&lt;/strong&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;script&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;The above method uses the selector function &lt;strong&gt;$&lt;/strong&gt; to select DOM elements (in this case – a single element with id = txtName) and to apply a style property of a red border. Running this page and clicking the button results in this output:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; margin: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="jQuery IntelliSense in Visual Studio 2008 - KB946581" border="0" alt="jQuery IntelliSense in Visual Studio 2008 - KB946581" src="http://blogs.msdn.com/blogfiles/bursteg/WindowsLiveWriter/GettingStartedwithjQueryinVisualStudio20_F0A6/image_c008d991-ab24-451d-89c2-068b7c05b1f8.png" width="249" height="33" /&gt; &lt;/p&gt;  &lt;h3&gt;Summary&lt;/h3&gt;  &lt;p&gt;In this post I talked about the steps you should follow in order to use &lt;strong&gt;jQuery in Visual Studio 2008 with InstelliSense support&lt;/strong&gt;. Then, we used jQuery in a simple web application.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9701557" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/bursteg/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/bursteg/archive/tags/ASP.Net+MVC/default.aspx">ASP.Net MVC</category><category domain="http://blogs.msdn.com/bursteg/archive/tags/ASP.Net/default.aspx">ASP.Net</category><category domain="http://blogs.msdn.com/bursteg/archive/tags/jQuery/default.aspx">jQuery</category></item></channel></rss>