值不在jquery中回归

时间:2016-04-04 10:51:20

标签: jquery html forms

我有一个登录表单,但val()函数没有任何帮助请帮忙 什么是错误?  {这只是为了允许提交没有看到这只是为了允许提交没有看到这只是为了允许提交不要看到这只是为了允许提交不要看到这只是为了允许提交没有看到

<form method="post" id="form" action="">
    <input id="fname" type="text" placeholder="First name" >
    <input id="lname" type="text" name="lastname" placeholder="Last Name">
    <input id="email" type="text" name="email" placeholder="Email">
    <input id="phone" type="text" name="phone" placeholder="Phone Number">
    <input id="age" type="text" name="age" placeholder="age">
    <input type="text" name="address" placeholder="Address / City">
    <input type="text" name="state" placeholder="state ">
    <select name="country">
    <option value="-">Country</option>
    <option value="australia">Australia</option>
    <option value="usa">usa</option>
    <option value="newzealand">New-zealand</option>
    </select>
    <select name="interest">
    <option value="-">Fitness Interest</option>
    <option value="Weightloss">Weight loss</option>
    <option value="GainMuscle">Gain muscle</option>
    <option value="Dailyfitness">Daily fitness</option>
    </select>
    <input type="submit" id="sjsj">
</form>
<div id="banner">
</div>


</div>
</div>

</div>
<script type="text/javascript" src="js/jquery.js"></script>
<script>
    $(document).ready(function(e) {
         var fname = $('#lname').val();
         $('#sjsj').click(function(e) {
             alert(fname);
             e.preventDefault();
             $('#form')[0].reset();
         });
    });
</script>
</body>
</html>

0 个答案:

没有答案