ComboBox项风格 [英] Combobox item style
本文介绍了ComboBox项风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的项目是asp.net MVC,使用Telerik的MVC组合框。我可以改变的第一个项目的样式为如果我使用:
my project is asp.net MVC, using Telerik MVC combobox. I can change the sytle of the first item if I use:
var item = combobox.dropDown.$items.first();
item.addClass('test');
或更改的所有项目,使用:
Or change all items, using:
combobox.dropDown.$items.addClass('test');
不过,我需要改变只是特定项目(基于模型),我尝试:
But I need to change just specific items (based on a model), I tried:
combobox.dropDown.$items[1].addClass('test');
我得到这个错误:
对象不支持属性或方法addClass
推荐答案
如果它是一个jQuery对象,应更换:
If it's a jQuery object, you should replace:
combobox.dropDown.$items[1].addClass('test');
使用:
combobox.dropDown.$items.eq(1).addClass('test');
$项目[1]
给你不具有jQuery的 addClass
函数的DOM对象。 $ items.eq(1)
让你拥有了jQuery jQuery对象 addClass
功能。
$items[1]
gives you the DOM object which doesn't have the jQuery addClass
function.
$items.eq(1)
gives you the jQuery object which has the jQuery addClass
function.
这篇关于ComboBox项风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文