-1

Is it possible to restrict where it looks for the certain text?

$(data,'table tr').each(function(){

});

Is what I have right now. Am I any where near right?

Tyler
  • 24
  • 2
  • can you expand on what you are trying to do? you code is iterating through all rows in "data" where data is a DOM object – Reina Oct 26 '11 at 03:17

2 Answers2

2

See jQuery() (aka the $() function) and see the supported forms.

It would likely be $(selector, context) where context is "A DOM Element, Document, or jQuery".

Alternatively, create a jQuery object and then apply the appropriate traversing function(s).

Happy coding.

0

I believe this is what you're looking for: How to skip to next iteration in jQuery.each() util?

var arr = [ "one", "two", "three", "four", "five" ];
$.each(arr, function(i) {
    if(arr[i] == 'three') {
        return true;
    }
    alert(arr[i]);
});

You can check certain conditions on the tr, like, does it have children? And if so, skip to the next iteration.

Community
  • 1
  • 1
Josh
  • 12,448
  • 10
  • 74
  • 118