jquery ui自动完成中的CSS内部xml响应
有没有一种方法可以为xml响应中的标签部分指定不同的css类? 换句话说,标签值现在为jquery ui自动完成中的CSS内部xml响应,jquery,css,xml,user-interface,autocomplete,Jquery,Css,Xml,User Interface,Autocomplete,有没有一种方法可以为xml响应中的标签部分指定不同的css类? 换句话说,标签值现在为 label: $( "name", this ).text() + ", " + ( $.trim( $( "countryName", this ).text() ) || "(unknown country)" ) + ", " + $( "countryCode", this ).text() 我希望只给$(“countryCode”,this).text()一个不同的css类,因为我希望它的字体必须
label: $( "name", this ).text() + ", " + ( $.trim( $( "countryName", this ).text() ) || "(unknown country)" ) + ", " + $( "countryCode", this ).text()
我希望只给$(“countryCode”,this).text()一个不同的css类,因为我希望它的字体必须比其他字体(name和countryName)小
有办法吗
success: function( xmlResponse ) {
var data = $( "geoname", xmlResponse ).map(function() {
return {
value: $( "name", this ).text()
,
label: $( "name", this ).text() + ", " +
( $.trim( $( "countryName", this ).text() ) || "(unknown country)" ) + ", " +
$( "countryCode", this ).text()
,
id: $( "geonameId", this ).text()
};
}).get();
将其包装在
span
中,并为span指定类。既然你正在使用XML,你可以考虑使用一个更有意义的标签并对它进行样式化(除非这只是XHTML)。这是我们的想法,但我不能让它工作。如果我使用标签:$(“名称”,this.text()+”,“+($.trim($($(“国家名称”,this.text())| |(未知国家)”)+”,“+$(“国家代码”,this.text()都被视为文本,而不是html。你有没有一个我能理解如何分类的工作示例?谢谢