Combobox item style

蓝咒 提交于 2019-12-08 05:11:28

问题


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');

I get this error: Object doesn't support property or method 'addClass'


回答1:


If it's a jQuery object, you should replace:

combobox.dropDown.$items[1].addClass('test');

With:

combobox.dropDown.$items.eq(1).addClass('test');

$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.



来源:https://stackoverflow.com/questions/12556524/combobox-item-style

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!