Hi all, I'm trying to add a class to some input elements depending on the type, so if it's type='text' iI want to add .txt class and if it's typt='button' I want to add .btn class. I tried some stuff but so luck, it adds .text to all of them:
var text_type = $('#right input').attr('type');
if(text_type=='text'){
$('#right input').addClass('text');
}
else if(text_type=='button'){
$('#right input').addClass('btn');
};
How do I achieve that? Thanks in advance.
Mauro