当我更改选择框时,我显示了选择框,其中包含来自DB的一些值,使用ajax,如下图所示,
但我想显示如下所示的选择框
所以我尝试使用jquery,
将代码标记更改为optgroup标记function callback() {
if (req.readyState == 4) { //complete and response received from server
if (req.status == 200) { //the status==200 is getting you a message where the server says: 'Hey man I do the work!'
var message = req.responseText;
$("#selectboxDivId").html(message);
var oSrc = document.getElementById('SelectFeatures');
for (var i = 0; i < oSrc.options.length; i++) {
if (oSrc.options[i].text=="Game" | oSrc.options[i].text=="Lession" | oSrc.options[i].text=="Summary") {
// oSrc.options[i].disabled=true;
// $(this).css({ 'color' : 'red','font-size' : '250%'} );
// Here I want to chnage option to optgroup tag!!! how???
}
}
}
}
}
我希望有人能帮助我!