JSF正在将输入字段的ID设置为search_form:expression
.我需要在该元素上指定一些样式,但该冒号看起来像浏览器的伪元素的开头,因此它被标记为无效并被忽略.反正有没有逃过冒号或什么?
input#search_form:expression {
///...
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用PrimeFaces和JSF组件实现jQuery,但它无法正常工作.当我尝试用HTML标签做同样的事情时,它正常工作.
以下是带有HTML标记的代码,它可以与jQuery一起使用:
<input type="checkbox" id="check2"></input>
<h:outputText value="Check the box, if your permanent address is as same as current address."></h:outputText>
<h:message for="checkbox" style="color:red" />
Run Code Online (Sandbox Code Playgroud)
同
$("#check2").change(function() {
if ($("#check2").is(":checked")) {
$("#p2").hide();
} else {
$("#p2").show();
}
});
Run Code Online (Sandbox Code Playgroud)
以下是使用PrimeFaces/JSF的代码,它与jQuery无法正常工作:
<p:selectManyCheckbox >
<f:selectItem itemLabel="1" value="one" id="rad" ></f:selectItem>
</p:selectManyCheckbox>
Run Code Online (Sandbox Code Playgroud)
同
$("#rad").change(function() {
if ($("#rad:checked").val() == "one") {
$("#p2").hide();
} else {
$("#p2").show();
}
});
Run Code Online (Sandbox Code Playgroud)