以下のように、jQuery を使用して HTMLchange
のすべてのイベント リスナーを登録しています。input
<h:head>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
$(':input').each(function() {
$(this).change(function() {
console.log('From docReady: ' + this.id);
});
});
});
function changeHandler() {
console.log("from changeHandler");
}
//]]>
</script>
</h:head>
<h:body>
<h:form id="topForm">
<p:commandButton id="myButton" value="update"
action="#{testBean.submit}"
partialSubmit="true" process=":myForm:panel"
update=":myForm:panel" />
</h:form>
<h:form id="myForm">
<p:panel id="panel">
<p:inputTextarea id="myTextarea"
value="#{testBean.val}"
onchange="changeHandler();"/>
</p:panel>
</h:form>
</h:body>
ユーザーが のコンテンツを変更すると、両方change
のイベントがトリガーされますmyTextarea
。ただし、を部分的に更新する更新ボタンを押した後myTextarea
は、changeHandler のみがトリガーされます。バインドされたイベント$(document).ready()
がトリガーされなくなりました。
これは PrimeFaces に関連するものですか、または予想される動作ですか? はいの場合、ドキュメント準備スクリプトを再実行せずに 2 番目のイベントを確実にトリガーするにはどうすればよいですか。