jquery val() not working
- by Vina
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?