문제

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;
도움이 되었습니까?

해결책

This worked for me after i posted this question

document.getElementById('relationshipTypeId').setAttribute('value',0);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top