我有一个返回国家列表的 AJAX 函数。它工作正常。
我的问题是,想要将这些国家加载到已经在 HTML 中并且为空的选择框中意味着其中没有选项值。
我想知道如何使用 moo tools 1.2 创建一个新的选项元素并注入到选择框中
我使用了下面的代码,但它在 IE 中不起作用。
var NewOption = new Option("Select Sub Category",'0');
NewOption.inject($('nSub_nIndustryID'))
谢谢
阿维纳什
我有一个返回国家列表的 AJAX 函数。它工作正常。
我的问题是,想要将这些国家加载到已经在 HTML 中并且为空的选择框中意味着其中没有选项值。
我想知道如何使用 moo tools 1.2 创建一个新的选项元素并注入到选择框中
我使用了下面的代码,但它在 IE 中不起作用。
var NewOption = new Option("Select Sub Category",'0');
NewOption.inject($('nSub_nIndustryID'))
谢谢
阿维纳什
无需创建变量,除非您稍后要使用它。
new Element('option', {'value': 0, 'text':'Select states first'}).inject($('sCity'));
我自己解决了..
var newElement = new Element('option');
newElement.inject($('sCity'));
newElement.setProperty('value','0');
newElement.appendText('Select States first');
谢谢你的时间....