3
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<script src="/resources/js/jquery-1.7.2.js" ></script>
<script >
$j=jQuery.noConflict();
function appendText() {
alert('hi');
var txt1 = "<p>Text.</p>";
var txt2 = $j("<p></p>").text("Text.");
var txt3 = document.createElement("p");
txt3.innerHTML = "Text.";
$j("p").append(txt1, txt2, txt3);
}
function appendList() {
var item1 = "<li>List item</li>";
var item2 = $j("<li></li>").text("List item");
var item3 = document.createElement("li");
item3.innerHTML = "List item";
$j("ol").append(item1, item2, item3);
}
</script>
</h:head>
<h:body>
<f:verbatim>
<p>This is a paragraph.</p>
<ol>
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
</ol>
<button id="btn1" onclick="appendText()">Append text</button>
<button id="btn2" onclick="appendList()">Append list items</button>
</f:verbatim>
<h:form>
<h:commandButton value="jsf cmd btn APPEND TEXT" onclick="appendText()" id="btn3"/>
</h:form>
</h:body>
</html>
이것은 스크립트의 JQuery 코드가있는 간단한 JSF 페이지입니다.JSF (Primefaces)에서 JQuery가 작동하지 않는 이유
실행하면 페이지가 제대로로드됩니다. 그러나 JQuery 스크립트를 호출하지 않습니다.
나는 왜 ... 몸이 무엇을 잘못하고 있는지 제안 해 줄 수 있습니까?
감사합니다.
오케이 .. 시도해 보겠습니다. –
첫 번째 수정이 잘못되었습니다. '$()'는 완벽하게 작동합니다. – BalusC
maple_shaft를 시도했지만 여기서는 작동하지 않습니다. –