Domanda

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;
È stato utile?

Soluzione

This worked for me after i posted this question

document.getElementById('relationshipTypeId').setAttribute('value',0);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top