문제

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?

도움이 되었습니까?

해결책

 $(':input[name]').filter(function() {
   return this.name.toLowerCase() == 'something-really.etc';
 });

다른 팁

You can do this:

$('input[type="text"][name]').filter(function() {
   return this.name.toLowerCase() == 'something-really-complex-and-annoying';
}).addClass("yay");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top