开发者

change value of h:outputtext using jquery

开发者 https://www.devze.com 2023-02-26 11:27 出处:网络
i have one component OutputText , i want to change its value using jquery, my component is, <h:outputText id=\"txt_pay_days\"value=\"0\"

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');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号