Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7983539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:59:20+00:00 2026-06-04T10:59:20+00:00

I am using 10 Comment box in my page. The button works perfectly but

  • 0

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",
.
.
.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:59:21+00:00Added an answer on June 4, 2026 at 10:59 am
    $('body').on('keyup','input.commentadd', function(e) {
      // e.which is monitoring the key pressed 
      // and 13 is code for enter key
      if(e.which == 13 && $.trim(this.value).length) {
        $(this).next(".bsubmit").click(); // triggering click event on button
      }
    });
    

    DEMO

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using the XFBML version of the Like button but the Share it box
I am creating facebook comment box,it works fine with the static urls, but my
I am using XFBML version of the Like button and it works great except
I am integrating a like button and a comment box (mobile) inside a web
When I add a comment using the variable below, apostrophes are printed with a
I am using the built in comment system with Django but it has started
I am using NERD commenter Let's say that I want to comment out lines
I'd like to be able to comment on a particular Revision in SVN (using
I am trying to add a simple comments/message box to a web page. When
I am developing a comments box that will save the comment through a JQuery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.