title: JQuery in Visual Web Part SharePoint Foundation
body: <p>I am unable to make this simple JQuery function to fire in sharePoint Foundation. </p>
  
  <p>These are some of the steps I followed from 
  <a href="http://sharepointdragons.com/2012/04/18/adding-jquery-to-a-visual-web-part-and-then-implement-parentchild-radio-buttons/" rel="nofollow">http://sharepointdragons.com/2012/04/18/adding-jquery-to-a-visual-web-part-and-then-implement-parentchild-radio-buttons/</a></p>
  
  <p>Step 1 : Add the jquery-1.4.1.js file to SiteAssets</p>
  
  <hr>
  
  <p>Step 2 : Create a Visual Web Part in a Web Farm Solution.</p>
  
  <hr>
  
  <p>Step 3 : Add the below code</p>
  
  <hr>
  
  <p>Step 4 : Deploy the web Part on the Server (Successfull as non-jquery functionality is working).</p>
  
  <hr>
  
  <p>step 5: But the jquery functionality is not working.</p>
  
  <p>Here is all the code of the web part</p>
  
  <p>WebPart1.ascx</p>
  
  <pre><code>    &lt;%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %&gt;
    &lt;%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral,    PublicKeyToken=71e9bce111e9429c" %&gt; 
  &lt;%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %&gt; 
  &lt;%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %&gt;
  &lt;%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %&gt;
  &lt;%@ Import Namespace="Microsoft.SharePoint" %&gt; 
  &lt;%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %&gt;
  &lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SanctuaryVisualWebPartUserControl.ascx.cs" Inherits="SanctuaryVisualWebPart.SanctuaryVisualWebPart.SanctuaryVisualWebPartUserControl" %&gt;
  &lt;%@ Register assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.WebControls" tagprefix="asp" %&gt;
  &lt;SharePoint:ScriptLink ID="ScriptLink1" runat="server"  name="~sitecollection/SiteAssets/jquery-1.4.1.js "  /&gt;
  
  
    &lt;style type="text/css"&gt;
         .style1
      {
          width: 100%;
          height: 247px;
      }
      .style2
      {
          width: 398px;
      }
      .style3
      {
          width: 421px;
      }
  &lt;/style&gt;
         &lt;script type="text/javascript"&gt;
             $(document).ready(function () {
  
                alert("Fired using JQuery Document ready");
                 $("#btnJQ").click(function () {
  
                     $("#tboxJQ").val("Fired using JQuery");
                    alert("Fired using JQuery");
                 });
             });
                &lt;/script&gt;
  
  &lt;table bgcolor="#CCFFCC" border="3" cellpadding="3" cellspacing="3" 
      class="style1"&gt;
  
  
  
  
      &lt;tr&gt;
      &lt;td&gt;
          &lt;asp:Button ID="btnJQ" runat="server" Text="JQuery" Width="110px" /&gt;
          &lt;/td&gt;
      &lt;td&gt;
          &lt;asp:TextBox ID="tboxJQ" runat="server"&gt;&lt;/asp:TextBox&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Step 6 :The first alert from document.ready is fired but the next alert from inside the buttonClick is not.</p>
  
  <p>Any help would be greatly appreciated</p>