开发者

jQuery on Primefaces stopped working after page submit

开发者 https://www.devze.com 2023-04-02 21:20 出处:网络
Hi i´m using Primefaces 2.2.1. When I try to use jQuery it works fine the first time. If I change de value of the select box with ID \"parentMenu\" it will show the alert. Now if I submit the page an

Hi i´m using Primefaces 2.2.1. When I try to use jQuery it works fine the first time. If I change de value of the select box with ID "parentMenu" it will show the alert. Now if I submit the page and it returns to the same page because validations failed and try to change the value of the select box the alert will not show anymore.

Anyone knows why jQuery stops working? Thanks.

jQuery('select[id*="parentMenu"]').change(function () {
    alert('worked');
});

Here´s my Primefaces submit button:

<p:commandButton id="btSave" value="Save" update="msgs, itensForm" actionListener="#{itensBean.save}" style开发者_C百科="margin-left:5px;" />


Try to change your jQuery code to be like this:

jQuery('select[id*="parentMenu"]').live(function () {
    alert('worked');
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号