html - jquery fetching blank value from input field -


I have a form where there is 2 inputs and 1 texeter, when a user submits the form, the default behavior of the form The AJAX stopped to make way for the request. Here's the code I'm using.

  $ (document) .ready (function () {$ ('input # submit') (function () {$ name = $ ('input # name'). Val ( ); Alert ($ name); return false;}););   

And here is my html form

  & lt; Form action = "" method = "post" id = "mail-form" & gt; & Lt; Label = "name" & gt; Name * & lt; / Label & gt; & Lt; Br / & gt; & Lt; Input type = "text" name = "name" id = "name" /> gt; & Lt; Br / & gt; & Lt; Label = "email" & gt; Email * & lt; / Label & gt; & Lt; Br / & gt; & Lt; Input type = "text" name = "email" id = "email" /> gt; & Lt; Br / & gt; & Lt; Label = "message" & gt; Message * & lt; / Label & gt; & Lt; Br / & gt; & Lt; Textarea id = "message" & gt; & Lt; / Textarea & gt; & Lt; Input type = "submit" name = "submit" value = "send" id = "submit" /> & Lt; / Form & gt;   

When I click on submit button, it only displays empty values ​​in the warning box, even if I enter some value in the Name field. However, if I use the following code for the form.

  & lt; Input type = "text" name = "name" id = "name" value = "yourname" />   

This displays your name properly in the warning box. What's wrong with my code?

Update:

This is my complete (http://jsfiddle.net/MknfR/)file, is there anything wrong with DOM?

Very strange this works great

please test it:.

Please, with that link, make sure that it does not come from your development environment.

Regards

Comments