我想在javascript.I与空间下拉值已经使用$(“#LOC”)。VAL()和的document.getElementById(“LOC”)。价值,但我只有一个和三个基础上,得到了下面的code.it只在空间之前,我想要的答案,像一二三四。如何获得选择框值与JavaScript中的空间?
<form method="post" action="" name="xxx">
<select name="loc" id="loc">
<option value="one two">Choice 1</option>
<option value="three four">Choice 2</option>
</select>
</form>
请分享此答案?提前致谢。
在你的代码段中没有id为'loc'的元素。无论如何,它应该工作,即使值的空间。 –
做工精细http://jsfiddle.net/uMr4R/ – Johan