Cannot read JSF component id

I have a little problem. I'm trying to use the MartkItUp jQuery text editor in a JSF text component. My form is as follows:

 <h:form id="comment">
    <h:inputTextarea id="commentBody" cols="10" rows="10" value="#{postComment.commentBody}" required="true" requiredMessage="Comment Body is reqguired" >
      <f:validateLength maximum="500" minimum="2" />
    </h:inputTextarea>
                <%-- more of the form... %-->

The problem is that in the output it gives me an id for textarea like

id="comment:commentBody"

When I try to point to it in jQuery, nothing happens.

$('#comment:commentBody').markItUp(mySettings);

I used to have regular text ads, and there were no problems. Now I have a lot of them.

How to specify id in jQuery, it looks like comment: commentBody

PS: I know that I can point to this text area on $ ('textarea'). markItUp (mySettings); however, I am looking for a solution to point to a specific area of ​​the text by its identifier.

+3
3

, $('#comment\\:commentBody'), JQuery 1.1.3 .

+12

:

$("textarea[id$='commentBody']").markItUp(mySettings);

.

, , $ ^

+1
+1

Source: https://habr.com/ru/post/1710120/


All Articles