제출 버튼을 클릭하면 내 jQuery 함수가 호출되지 않습니다. 있는 명령 : 시간에 아약스 라인 :jQuery와 f : ajax 사이의 충돌
는 Nevetheless는, jQuery를 내가 F를 제거하면 클릭을 감지합니다.
어떻게 작동합니까? f : ajax 및 jQuery이 함께 작동합니까?
XHTML :
<h:form>
<!-- my inputs-->
<h:commandButton id="submit-button" type="button" value="Confirm" >
<f:param name="id" value="#{param.id}" />
<f:ajax execute="@form" render="@none" />
</h:commandButton>
</h:form>
자바 스크립트 :
jQuery(document).ready(function() {
jQuery('input[id*="submit-button"]').click(function() {
console.log("button clicked");
}); });
렌더링 된 응답을 살펴보십시오. submit 버튼의 id는'form : submit-buttom'과 같은 부모 컴포넌트의 id 앞에 붙여야합니다 (' '과 연관된'prependId'가 false로 설정되어 있지 않으면, 권장되지 않습니다). –
Tiny
나는'form : submit-buttom' 구문으로 이미 시도해 보았습니다. 앞에서 말한 것처럼 jQuery는 ''줄을 제거해야만 클릭을 감지합니다. 아약스에서 오는 문제처럼 보입니다 ... –
js 함수를 호출하기 위해' '의'onclick' 속성을 사용하지 않는 이유는 무엇입니까? –
whitesite