I am using 10 Comment box in my page. The button works perfectly but now I would like to add functionality that, when I press the enter button then automatically the text is submitted.
How can I add this function without changing much code. I am binding the bsubmit class with the event On click. ( There are 10 comment boxes )
<div class="addcomment" style="display: block; ">
<input class="commentadd" type="text" name="comment" value="Enter Comment" onfocus="if(this.value=='Enter Comment')this.value='';">
<button class="bsubmit" type="button">Submit</button></div>
EVENT CODE
$(document).ready(function() {
$(function() {
$(".bsubmit").live("click", function() {
var id = $(this).parent().parent().attr("id");
var comm= document.getElementById(id).getElementsByClassName("commentadd")[0].value;
$.ajax({
type: "POST",
url: "comment.php",
.
.
.
DEMO