Select input with id! = value

1

a selector like this:

$('#minhaDiv input[id!="meuId1"]');

It's common. I'd like to know if it's possible to do something like this:

$('#minhaDiv input[id!="meuId1" && id!="meuId8"]');

Thank you.

    
asked by anonymous 23.10.2015 / 16:04

1 answer

3

I know two ways to do this:

$('#minhaDiv input[id!="meuId1"][id!="meuId8"]');

or

$('#minhaDiv input').filter(function(){
    var id = jQuery(this).attr('id');
    var idInvalidos = [
        'meuId1',
        'meuId8',
    ];
    return !jQuery.inArray(id,idInvalidos);
});
    
23.10.2015 / 16:13