jQuery: Selecting by class and input type

前端 未结 6 1192
忘了有多久
忘了有多久 2021-01-30 05:51

I would like to select a set of elements that are both of a certain input type (say, a checkbox) and have a certain class using jQuery. However, when I try the following:

6条回答
  •  说谎
    说谎 (楼主)
    2021-01-30 06:38

    You should use the class name like this

    $(document).ready(function(){
        $('input.addCheck').prop('checked',true);
    });
    

    Try Using this a live demo

提交回复
热议问题