2011-05-18 71 views
1
<html> 
<head> 
<script type="text/javascript" src="jquery.js"></script> 
<script type="text/javascript"> 
$(document).ready(function(){ 
    $(".region").load('getRecords.php?start=regions'); 

}); 
</script> 
</head> 
<body> 


<select> 

      <div class="region"></div>   

</select> 

</body> 
</html> 

加載每當我把這個列表中的<select>標籤內,它是完全不顯示...當我把它的<select>標籤,我得到外面...jQuery的AJAX不會裏面<select>

<option value="Central Asia">Central Asia</option> 
    <option value="Central Europe">Central Europe</option> 
    <option value="East Africa">East Africa</option> 
    <option value="East Asia">East Asia</option> 

有人有這個問題嗎?我無法在任何地方找到解決方案。

這個函數對我所做的這個XMLHttpRequest函數可以正常工作,但是今天有些女士在試圖向Internet Explorer註冊時發現它不起作用。 Blegh。所以,我正在切換到jQuery,並且它燒了。

回答

1

<select>內部不能有<div>。只需將該課程放在<select>上即可。

<select class="region"></select> 
+0

非常感謝。 :) – 2011-05-18 00:08:50

2

select元素不能有div子元素。他們只能有optionoptgroup元素作爲子女(see HTML specification)。當您將div放入select(特別是將divoption作爲子元素)時,會發生什麼情況取決於瀏覽器。

嘗試將它們載入select代替:給該元素而不是類:

<select class="region"></select> 
+0

很好的解釋,非常感謝! – 2011-05-18 00:09:54