Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery not working in this code
    text
    copied!<pre><code>&lt;%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage&lt;dynamic&gt;" %&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head runat="server"&gt; &lt;meta name="viewport" content="width=device-width" /&gt; &lt;title&gt;FillForm&lt;/title&gt; &lt;script type="text/javascript" src="../../Scripts/jquery-1.7.1.min.js" /&gt; &lt;script type="text/javascript"&gt;&lt;![CDATA[ function farax() { alert($('#txt_name').val()); return false; } ]]&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;form action="DisplayCustomer" method="post"&gt; &lt;span&gt; Enter customer id :- &lt;/span&gt; &lt;input type="text" name="Id" id="txt_name" /&gt; &lt;br /&gt; &lt;span&gt; Enter customer code :- &lt;/span&gt; &lt;input type="text" name="CustomerCode" /&gt;&lt;br /&gt; &lt;span&gt; Enter customer Amount :- &lt;/span&gt; &lt;input type="text" name="Amount" /&gt;&lt;br /&gt; &lt;input type="submit" value="Submit customer data" onclick="return farax(); " /&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The code above does not get the value inside the javascript function. What am i doing wrong here? This is a View in a ASP.NET MVC 4 application and I have not added any master pages. I tried using the same code inside a normal ASP.NET application and it worked fine but this seems to be skipping the javascript function altogather. Perhaps the jQuery is not loading properly. I have checked the path to see if it was faulty but that is also correct. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload