I am creating a Comment-Reply
system, similar to stackoverflow and I wonder how to implement it using JSF + jQuery. I have a dataTable, each row have a link and a textBox, and once I click a link, only the textbox on that same row appear, and put focus on that textbox.
<h:form id="userComment">
<p:dataTable value="bean.comments">
<p:column>
<!-- link that if u click on it, the textbox below appear -->
<h:inputTextarea id="reply" />
</p:column>
</p:dataTable>
</h:form>
My main obstacle is that, normal jQuery user would do this: let assume the link id
is foo then
$('#foo').click(function(){
//Make the box with id `reply` appear and put focus on it
});
But since each row has a textbox call reply
, there will be prependId before reply
and foo
like this userComment:1:foo
or userComment:1:reply
. Therefore $('#foo')
and $('#reply')
would not work