user424134
user424134

Reputation: 532

Combining Jquery filter with selector

I am trying to use a selector to filter on all input type.

var allInputTextboxes = $('input[type=text]');
var filteredList = allInputTextboxes.filter('Id$=' + endWithId);

I am not getting any result back. Is this doable?

Thanks...

Upvotes: 0

Views: 132

Answers (2)

genesis
genesis

Reputation: 50966

try to change

var filteredList = allInputTextboxes.filter('Id$=' + endWithId);

to

var filteredList = allInputTextboxes.filter('[id$="' + endWithId+'"]');

(assuming you have id attribute)

because first one makes no sense

Upvotes: 0

SLaks
SLaks

Reputation: 887315

Your filter selector is wrong.

You're probably trying to write .filter('[id$="' + endWithId + '"]')

However, you should use a classname instead.

Upvotes: 3

Related Questions