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 8759715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:52:25+00:00 2026-06-13T14:52:25+00:00

In JSF 1.2 and I’m using h:commandButton type=button but the button does not trigger

  • 0

In JSF 1.2 and I’m using h:commandButton type=”button” but the button does not trigger when I tab on it and press enter. I tried using onkeypress="keyEnter(event)"

     function keyEnter(eve){
         if (eve.keyCode == 13) {
              document.getElementById(eve.target.id).click();
          }
          return false;
      }

and it triggers the button when enter key is pressed. Now here is my question, I have many h:commandButton elements with type button, what can I do in order to implement keyEnter(eve) to all the elements of type button?

Thanks in advance.

  • 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-13T14:52:27+00:00Added an answer on June 13, 2026 at 2:52 pm

    Try this

    FULL CODE

    function keyEnter(eve){
        var key = eve.keyCode || eve.which;
         if (key == 13) {
             document.getElementById(eve.target.id).click();
         }
          return false;
    };
    

    To bind all You can do this

    $('input[type="button"]').on("keyenter",function(eve){
         var key = eve.keyCode || eve.which;
         if (key == 13) {
              $(this).click();
          }
          return false;        
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using JSF templates and Primefaces. Javascript code does not seem to be working
In JSF 2 (SUN RI ) UI:repeat does not increment the id of table
JSF h:column tag fix width I tried this way, but I couldn't get this
I'm using JSF 2 and I need c:foreach in some purposes. But no matter
In JSF you can display validation error's using <h:messages /> . But what I
In JSF's tag, if you feed it using a Map<Key, Value> <h:selectOneMenu value=#{bean.integerProperty}> <f:selectItems
In JSF + RichFaces, I have an inputText and a button, How can I
Using JSF 2.0. Got an app running with CSS and Javascript running from /Servlet/resources/css
In JSF, I am using panelGrid which is equivalent to table in html. How
I have a JSF 1.2 dataTable using ICEfaces 1.8. In one column, I would

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.