The following event is not getting invoked:
<script>
$("#inputTxt").change(function() {
alert("changed");
});
</script>
The code for inputTxt is as follows:
<p:inputText id ="inputTxt" name="inputTxt" value="#{article.description}"
style="border:none; box-shadow:none;"/>
The coloumn “articleDescription” is defined in a datatable named “articlesInformation” which is placed on a form “articleForm”.
On inspected the element, I found that the id of the inputText becomes – “articlesInformation:0:inputTxt”. Probably that is the issue.
Viewing page info says :
<td role="gridcell">
<div class="ui-dt-c">
<input id="articlesInformation:0:inputTxt" name="articlesInformation:0:inputTxt"
type="text" value="Description of Article 1"
style="border:none; box-shadow:none;"
class="ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all" />
<script id="articlesInformation:0:inputTxt_s"
type="text/javascript">PrimeFaces.cw('InputText','widget_articlesInformation_0_inputTxt'
{id:'articlesInformation:0:inputTxt'});
</script></div></td>
How should the jquery be defined for primefaces components?
Thanks,
Shikha
When inputText is placed in datatable, primefaces gives it id = datatable_id:row_index:inputText_id. That is, the inputText in row 7 is given the id = datatable_id:7:inputText_id. Try the below …
Hope this helps