1

I know this is possible with the :contains selector IE:

How do I make jQuery Contains case insensitive, including jQuery 1.8+?

But is this possible using similar logic:

 <input type="text" name="SomeThing-Really-Complex-and-Annoying" />

Can I select that element by it's name on a case insensitive level EG. This would work:

$('input[name="something-really-complex-and-annoying"]').addClass('yay');

if you see what I mean?

Community
  • 1
  • 1
Strontium_99
  • 1,771
  • 6
  • 31
  • 52
  • 3
    [css-selector-case-insensitive-for-attributes](http://stackoverflow.com/a/5671252/1696560) – Anton Apr 09 '14 at 13:58

2 Answers2

2
 $(':input[name]').filter(function() {
   return this.name.toLowerCase() == 'something-really.etc';
 });
A. Wolff
  • 74,033
  • 9
  • 94
  • 155
JF it
  • 2,403
  • 3
  • 20
  • 30
2

You can do this:

$('input[type="text"][name]').filter(function() {
   return this.name.toLowerCase() == 'something-really-complex-and-annoying';
}).addClass("yay");
Amit Joki
  • 58,320
  • 7
  • 77
  • 95