我正在使用 jQuery 和 javascript 制作应用程序,该应用程序依赖于使用从 XML 文件中获取其值的单选按钮,因此在运行代码之前我无法预测该值,因为它依赖于代码的处理,这是我正在考虑的一段代码:
oc=$('menu').find($(".selected").text()).children().eq(si).children().length
optionstring=''
for(oi=0;oi<=oc-1;oi++)
{
itemoptions[oi]=$('menu').find($(".selected").text()).children().eq(si).children().eq(oi).prop('nodeName'); // that's the value i wanna asssign
optionstring=optionstring+'<input type="radio" name="iCheck" id="icheck" ><p style="line-height:10px; font-size:15px;">'+(itemoptions[oi]).toString()+'</p>' here i wrote the value as a paragraph and that make it not related to the radio button
}
}
我试着让它这样:
optionstring=optionstring+'<input type="radio" name="iCheck" id="icheck" value=(itemoptions[oi]).toString()>
但这给了我“(itemoptions [oi]).toString()”而不是它的价值。