【发布时间】:2013-12-08 20:20:55
【问题描述】:
我有一个国家/地区下拉菜单触发 ajax 调用以在选择时获取子状态。
这是状态下拉html:
<div id="statediv" ><select name="state" style="width:200px;" id="stateDrop">
使用此功能:(有效)
function getState(countryId) {
var strURL="findState.php?country="+countryId;
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
document.getElementById(\'statediv\').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
when the page loads the drop down is the correct width, but when a country is selected and the states load, the state drop down changes/loses the width setting and defaults to the biggest word in the drop down.我试过给状态 dropdpwn 一个 id 并用 jquery 更改它,但它不起作用 - 有什么想法吗?
发送
【问题讨论】:
标签: css ajax width html-select