How to select all textareas and textboxes using jQuery?

后端 未结 5 2058
有刺的猬
有刺的猬 2020-12-02 15:03

How can I select all textboxes and textareas, e.g:


and


         


        
5条回答
  •  死守一世寂寞
    2020-12-02 15:52

    $('input[type=text], textarea').css({width: '90%'});
    

    That uses standard CSS selectors, jQuery also has a set of pseudo-selector filters for various form elements, for example:

    $(':text').css({width: '90%'});
    

    will match all elements. See Selectors documentation for more info.

提交回复
热议问题