Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
81
rated 0 times [  83] [ 2]  / answers: 1 / hits: 148230  / 15 Years ago, tue, may 5, 2009, 12:00:00

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



<input type='text' />


and



<textarea></textarea>


on a page and have the property style.width=90%; applied to them?


More From » jquery

 Answers
1
$('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 <input type=text> elements. See Selectors documentation for more info.


[#99592] Thursday, April 30, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
trinityr

Total Points: 49
Total Questions: 107
Total Answers: 96

Location: Mayotte
Member since Fri, Oct 1, 2021
3 Years ago
;