Pregunta

I have a Struts select list however i would like to use javascript to set selected option to the default headerKey and headerValue specified when creating the item. I am unable to get the option to set. Under is my select list:

Struts Select List

<s:select id="relationshipTypeId"
name="relationshipTypelist" headerKey= "0" headerValue="Select Relationship Type"
list="relationshipTypelist"
listKey="id" listValue="relationshipName"/>

Javascript

This does not work it only sets the display item to 0 i would like it to default to the headerKey and headerValue.

  document.getElementById('relationshipTypeId').value = 0;
¿Fue útil?

Solución

This worked for me after i posted this question

document.getElementById('relationshipTypeId').setAttribute('value',0);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top