Just use the attribute, like this
$( 'input[the-attribute]' )
Note, if the values you test on does not start with the same characters, like in sample 3, then they need to be added as a list, exactly how you do already, or as suggested/commented, add a specific class to the one's to target
Read more here about attribute selectors: MDN Attribute selectors
Sample 1, target elements having the attribute [the-attribute]
$( 'div[data-color]' ).css("color", "red");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>Hey 1</div>
<div data-color="green">Hey 2</div>
<div data-color="blue">Hey 3</div>
<div>Hey 4</div>
Sample 2, target elements having 2 (or more) attribute [the-attribute][the-attribute2]
$( 'div[data-color][data-image]' ).css("color", "red");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>Hey 1</div>
<div data-color="green">Hey 2</div>
<div data-color="blue" data-image="icon">Hey 3</div>
<div>Hey 4</div>
Sample 3, target elements where the attribute's value starts with width [data-size^=width]
$( 'div[data-size^=width]' ).css("color", "red");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>Hey 1</div>
<div data-size="width200">Hey 2</div>
<div data-size="width400">Hey 3</div>
<div>Hey 4</div>
Sample 4, target elements where the attribute's value contains the value [data-size*=width]
$( 'div[data-size*=width]' ).css("color", "red");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>Hey 1</div>
<div data-size="height100width200">Hey 2</div>
<div data-size="length300width400">Hey 3</div>
<div>Hey 4</div>