Call button from JavaScript
<p>I'm new to JavaScript. I need help to modify this script. I want when I click on a table row to call the button below using the unique id of the button. </p>

<pre><code>$(document).ready(function(){
        $(selector).click(); //selector = h:commandLink
});


$(selector).find('tr').each(function(){ //selector = h:dataTable
        $(this).click(function(){
                $(selector).trigger('click'); //selector = h:commandLink       
        });
});

&lt;h:commandLink id="lnkHidden" action="#{bean.pageRedirect}" style="text-decoration:none; color:white; display:none"&gt;

&lt;/h:commandLink&gt;
</code></pre>

<p>Can you help me to solve this problem, please?</p>

<p>P.S
This is the code of the table:</p>

<pre><code>&lt;h:form id="form" &gt;
&lt;!-- The sortable data table --&gt;
&lt;h:dataTable id="dataTable" headerClass="columnHeader" value="#{bean.dataList}" binding="#{table}" var="item"&gt;
    &lt;!-- Check box --&gt;
    &lt;h:column&gt;
        &lt;f:facet name="header"&gt;
            &lt;h:selectBooleanCheckbox style="margin-left: 0px;" value="#{bean.value}" class="checkall" &gt;
                &lt;f:ajax listener="#{bean.value}" render="@form" /&gt;
            &lt;/h:selectBooleanCheckbox&gt;
        &lt;/f:facet&gt;
        &lt;h:selectBooleanCheckbox  onclick="highlight(this);" value="#{bean.value" &gt;
            &lt;!-- if the user deselects one row deselect the main checkbox --&gt;
            &lt;f:ajax listener="#{bean.deselectMain}" render="@form" /&gt;
        &lt;/h:selectBooleanCheckbox&gt;
        &lt;!-- Click on table code --&gt;
        &lt;h:commandLink id="lnkHidden" action="#{bean.pageRedirect}" style="text-decoration:none; color:white; display:none"&gt;

        &lt;/h:commandLink&gt;
    &lt;/h:column&gt;
    &lt;!-- Row number --&gt;
    &lt;h:column&gt;
        &lt;f:facet name="header"&gt;
            &lt;h:outputText value="№" /&gt;
        &lt;/f:facet&gt;
        &lt;h:outputText value="#{bean.value}" /&gt;
    &lt;/h:column&gt;
..........

&lt;/h:dataTable&gt;
</code></pre>

<p>This is part of the code generated into the web browser:</p>

<pre><code>&lt;tr class=""&gt;
&lt;td&gt;
&lt;input id="form:dataTable:1:j_idt17" type="checkbox" onclick="jsf.util.chain(this,event,'highlight(this);','mojarra.ab(this,event,\'valueChange\',0,\'@form\')')" name="form:dataTable:1:j_idt17"&gt;
&lt;a id="form:dataTable:1:lnkHidden" onclick="mojarra.jsfcljs(document.getElementById('form'),{'form:dataTable:1:lnkHidden':'form:dataTable:1:lnkHidden'},'');return false" style="text-decoration:none; color:white; display:none" href="#"&gt;&lt;/a&gt;
&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;35435&lt;/td&gt;
</code></pre>
