Jquery wild card character

前端 未结 4 488
傲寒
傲寒 2020-12-20 23:39

I have 3 controls with id control_1, control_2, control_3.

I want to hide these controls.

Currently I am using this:

4条回答
  •  礼貌的吻别
    2020-12-21 00:19

    For completeness, you can use the starts with attribute filter:

    $('[id^="control_"]').hide();
    

    That said, for most purposes it would be better to go with one of the other suggestions.

提交回复
热议问题