简体   繁体   中英

How to change the CSS Class property dynamically

I setup my tagfield value by using class,

.x-tagfield-input-field {
    width: 3px;
}

I want to change width after selecting first element.

select : function(tag){
    var tagClass = component.inputCell.dom.getElementsByClassName("x-tagfield-input");

}

How to change the width after first element selection?

ExtJS provides addCls() method to add class dynamically. If you are giving width in class then add new class as tagClass.addCls(<new class name>) . If you want to specify width on the fly then use setWidth() as tagClass.setWidth(width in pixels) .

Check this and reply.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM