Issue with JSF and Jquery Id

When we use JSF ,by default any elements inside h:form will be appended with the form id like myform:myid when it's rendered as plain html.
jquery has trouble to identify this id with ':' as for example $("#myform:myid").html("this doesn't work.") will not work. Hence we can either

1. escape using "\\"
$("#myform\\:myid").html("this works");
or
2. add prependId=false in the h:form.
   
      ...
      
   

Now we can use jquery function like normal:
$("#myid").html("this works.");

or
3. if we do not want to add prependId to the h:form, we can use other jquery selectors such as class selector like :
$(".myclass").html("this will work as well."); .

1 comments: