h:commandButton 不会在 Chrome 中调用 js 函数

h:commandButton does not call a js function in Chrome

本文关键字:调用 js 函数 Chrome commandButton      更新时间:2023-09-26

我有一个<commandButton> PrimeFaces应该调用javascript连接。它在火狐中有效,但在 Chrome 中不起作用 simpleste 不调用可能导致此问题的函数?真的不知道会是什么。我有一个<commandButton> PrimeFaces应该调用javascript连接点。它在火狐中有效,但在 Chrome 中不起作用 simpleste 不调用可能导致此问题的函数?真的不知道会是什么。我在另一页上扩展了相同的情况,它有效。

.JS

function atualizarSelect(){
    update();       
    $('#j_idt31:voucherBeanVoucherVeiculo').load('search.xhtml');
    self.close();
}

我的命令按钮

<div class="buttons">
    <p:commandButton id="js"  onclick="atualizarSelect()" value="#{msg['btn-save']}" />
    <h:commandButton onclick="self.close()" value="#{msg['btn-cancel']}" />
    <p:remoteCommand id="update" name="update" actionListener="#{veiculoBean.updateModal()}"/>
</div>

我刚刚在Chrome 39.0.2171.95上尝试过,效果很好!可能按照狗鼻评论的建议,自动生成的 id 存在问题。

<script type="text/javascript">
    function atualizarSelect() {
        console.log('test');
    }
</script>
<h:form id="bcr_form_2" styleClass="form">
    <div class="buttons">
        <p:commandButton id="js" onclick="atualizarSelect()" value="#{msg['btn-save']}" />
    </div>
</h:form>