I have a custom component(named myComponent) which has an attribute value. I want to change the value of this attribute using javascript. How to do that ?
<apex:component >
<apex:attribute name="value" description="The value of picklist"
type="String[]" />
<script>
//change value of attribute here
var x = {!value}
x = ['val1', 'val2']
</script>
</apex:component >
visulaforce page:
<apex:form>
<c:myComponent value={!value}></<c:myComponent>
<apex:commandButton Value="Post"/>
</apex:form>
When I click the Post button, the value is not updated in the controller.