change value of h:outputtext using jquery
i have one component OutputText , i want to change its value using jquery,
my component is,
<h:outputText id="txt_pay_days" value="0"
bindin开发者_StackOverflow中文版g="#{Attendance_Calculation.txt_pay_days}"/>
thanks for any help...
<h:outputText>
will be converted to <span>
in raw HTML So,
Use id of the DOM and play with jQuery
${"#txt_pay_days"}.text("New Value To Set");
The <h:outputText>
renders a HTML <span>
with the value as its body.
<span id="txt_pay_days">0</span>
The jQuery .val()
function works on HTML input elements like <input type="text">
only. The <span>
isn't an input element at all. Instead, you need to use the jQuery .text()
function.
$("#txt_pay_days").text("123");
try this..
$('#txt_pay_days').val('valueYouWantToInsert');
精彩评论