- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
$('input').each(function () {
if ($(this).attr('type') == 'text') {
this.className = 'textInput';
}
if ($(this).attr('type') == 'password') {
this.className = 'passwordInput';
}
});
$('textarea').each(function () {
this.className = 'textarea';
});
if ($(this).attr('type') == 'text') {
this.className = 'textInput';
}
можно заменить на
$('input:text').addClass('textInput');
А текстарея обойдется без класса, можно описать и по тегу.