How to get elements of specific class starting with a given string?

后端 未结 11 847
面向向阳花
面向向阳花 2021-02-03 21:19

I have a list of elements that have multiple classes, for example:


         


        
11条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-03 21:32

    A class starting with btn and which can not be the first class:

    Working fiddle: http://jsfiddle.net/c9Tdx/

    $("input[class^='btn'],input[class*=' btn']").each(function(){
         //whatever
    });
    

提交回复
热议问题