How to select all textareas and textboxes using jQuery?

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

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


and


         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 15:47

    Password boxes are also textboxes, so if you need them too:

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

    and while file-input is a bit different, you may want to include them too (eg. for visual consistency):

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

提交回复
热议问题