Problem: Sometimes you will want to access a component from javascript with
getElementById
, but id\'s are generated dynamically in JSF, so you
I know this is not the JSF way but if you want to avoid the ID pain you can set a special CSS class for the selector. Just make sure to use a good name so that when someone reads the class name it is clear that it was used for this purpose.
In your JavaScript:
jQuery('.emailAddressesForSelector');
Of course you would still have to manually manage class name uniqueness. I do think this is maintainable as long as you do not use this in reusable components. In that case you could generate the class names using a convention.