How to get the focus to the button when the p:dialog pops up?

Posted on 2014-08-04
Last Modified: 2014-08-21
<p:dialog widgetVar="selectBriefDlg"
                     header="Selected Sections">
             <p:dataList id="reviewChosenList" value="#{bean.list}" type="definition" var="selected">
             <div style="float:right; margin-top:10px;">
                   <p:commandButton id="btnClose" value="Close"  onclick="selectBriefDlg.hide();"/>

Above is a primefaces dialog. Everything works great. All I want is when this dialogbox pops up, the "btnClose" to have focus by default.

Can someone help?
Question by:prain
    1 Comment
    LVL 17

    Accepted Solution

    <p:dialog widgetVar="selectBriefDlg"
                         header="Selected Sections">

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    Navigation is an important part of web design from a usability perspective. But it is often a pain when it comes to a developer’s perspective. By navigation, it often means menuing. This is less theory and more practical of how to get a specific gro…
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now