I have a custom component in my visualforce page, it requires an attribute :
<c:myCustomComponent id="myCC" attr='Some value'></c:myCustomComponent>
and I want to change the attribute value dynamically from javascript.
I tried getElementById('myCC').setAttribute('other value'), but it doesn’t seem to work, and the DOM doesn’t have a reference for the custom component Id.
You can not access visualforce elements with javascript directly by id you have entered, because the real id of generated dom element looks different.
I use jquery for that, it is very easy: