title: How to use jquery in MVC asp.net c#
body: <p>Currently I am working on online application form using MVC asp.net . </p>
  
  <p><strong>This is my form.</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Pu8wk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pu8wk.png" alt="enter image description here"></a></p>
  
  <p>What I want is that when user choose Individual radiobutton, the other radionbutton textfield should be disabled. I managed to achieved this using JSFiddle  <a href="http://jsfiddle.net/2LCnC/688/?utm_source=website&amp;utm_medium=embed&amp;utm_campaign=2LCnC" rel="nofollow noreferrer">here</a> .</p>
  
  <p>What I did was <br />
  <strong>1) Copied the coding from JSFiddle that I have created into the MVC view</strong></p>
  
  <pre><code>@model Insurance.ViewModels.RegisterInfoPA
  @{
    ViewBag.Title = "Insert";
   }
   &lt;h2&gt;Insert Fire Insurance&lt;/h2&gt;
  
  &lt;script&gt;
  $(".radioBtn").click(function () {
      $("#reg_title").attr("disabled", true);
      $("#reg_registerNm").attr("disabled", true); //Comp_Name//Name
      $("#reg_identityNo").attr("disabled", true); //Ic_No//army//com_regis
      $("#pinfo_gender").attr("disabled", true);
      $("#busInfo_dateRegisCompany").attr("disabled", true);
      $("#reg_dateCompRegis").attr("disabled", true); //DOB
      $("#pinfo_occupation").attr("disabled", true);
      $("#pinfo_maritalId").attr("disabled", true);
      $("#busInfo_contactNm").attr("disabled", true);
      $("#busInfo_natureBusiness").attr("disabled", true);
  
      if ($("input[name=reg.identityId]:checked").val() == "1") {
          $("#reg_title").attr("disabled", false);
          $("#reg_identityNo").attr("disabled", false);
          $("#pinfo_gender").attr("disabled", false);
          $("#reg_dateCompRegis").attr("disabled", false);
          $("#pinfo_maritalId").attr("disabled", false);
          $("#pinfo_occupation").attr("disabled", false);
      }
      if ($("input[name=reg.identityId]:checked").val() == "2") {
          $("#reg_registerNm").attr("disabled", false);
          $("#busInfo_dateRegisCompany").attr("disabled", false);
          $("#busInfo_natureBusiness").attr("disabled", false);
          $("#busInfo_contactNm").attr("disabled", false);
      }
  });
     &lt;/script&gt;
      @using (Html.BeginForm())
     {       
  @Html.AntiForgeryToken()
  @Html.ValidationSummary(true)
  &lt;link href="~/Content/FlexiPA.css" rel="stylesheet" /&gt;
  &lt;fieldset&gt;
      &lt;legend&gt;register&lt;/legend&gt;
      &lt;div class="flexiPAtitle"&gt;
          &lt;h3&gt;
              &lt;b&gt;
                  &amp;nbsp;&amp;nbsp;
                  @Html.RadioButtonFor(model =&gt; model.reg.identityId, 1, new { @class = "radioBtn" })
                  Individual Applicant&amp;nbsp;&amp;nbsp;
                  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;                    
                  @Html.RadioButtonFor(model =&gt; model.reg.identityId, 2, new { @class = "radioBtn" })
                  Company Application
  
                  @Html.HiddenFor(model=&gt;model.reg.insuranceTypeId, 3)
              &lt;/b&gt;
          &lt;/h3&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>I placed the code before @Html.BeginForm() . But it is not working.</p>
  
  <p><strong>2) So I tried to place the code into different js file then call it from view</strong> <br></p>
  
  <pre><code>&lt;h2&gt;Insert Fire Insurance&lt;/h2&gt;
    &lt;script src="~/Scripts/IndividualCompany.js"&gt;&lt;/script&gt;
    @using (Html.BeginForm())
    {   
  </code></pre>
  
  <p>It is still not working. Any ideas where I did wrong. How to use this jquery code in MVC, it confuses me, because when I did the code in JSFiddle everything is ok, but not in MVC. I have also install Jquery packages from the nuget manager. Really need some guidance.</p>
  
  <p>Thank you.</p>