jquery val() not working
Posted
by Vina
on Stack Overflow
See other posts from Stack Overflow
or by Vina
Published on 2010-06-07T11:23:34Z
Indexed on
2010/06/07
11:32 UTC
Read the original article
Hit count: 349
JavaScript
|jQuery
jQuery val() didnt working, this is the simple script:
$("#com_form").submit(function() {
var name = $("#nama").val();
var komentar = $("#komentar").val();
alert.("Hi, "+name+" this is your comment: "+komentar)
});
});*/
this is the HTML form:
<form method="post" name="com_form" id="com_form">
<p>What is your name:<br>
<input type="text" name="nama" id="nama">
</p>
<p>Leave your comment here:<br>
<input type="text" name="komentar" id="komentar">
</p>
<p>
<input type="submit" name="button2" id="button2" value="Submit">
</p>
</form>
actually, I was tried to create ajax post, the value "nama" is submited but not "komentar". So I tried to debug using alert (like one above) and still "komentar" is not change. What should I do?
© Stack Overflow or respective owner