문제

I have a combobox that is populated by JSP using JSON. The autocomplete functionality works beautifully however when I select on an item a lot of white space gets added into where the selected item is displayed.

If I leave it as is without the combobox function then the selected item appears normally without all the extra white space. Any idea what's going on here? I'd like to keep it as a combobox to fit the rest of the page. It's only this particular one that seems to be behaving like so.

<select id="box1">
   <option value=""></option>
      <core:forEach var="msg" items="${message}">
           <option value="<core:out value='${msg.messageValue}'/>">
               <core:out value="${msg.messageAlias}"/>
           </option>
      </core:forEach>
</select>

<script>
$(document).ready(function(){
 $('#box1').combobox();
});

</script>
도움이 되었습니까?

해결책

In case anyone else comes across this problem, I've found out what the issue was. Turns out jsp doesn't like how I had my options tag indexed so I just had to move everything to one line and that fixed it.

<option value="<core:out value='${msg.messageValue}'/>"><core:out value="${msg.messageAlias}"/></option> 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top