1

I would be able to find the first hidden parents of an element to make it visible.

trying this whitout succes :

$('input[name="toto"]').parents(":hidden:first").show();

ideas about this ?

tk_
  • 16,415
  • 8
  • 80
  • 90
ivan
  • 11
  • 1
  • Surely you want to find *all* hidden ancestors to make the descendant element visible? Otherwise it'll remain hidden unless you recursively call the same function/approach for *every* other 'first hidden parents.' – David Thomas Nov 12 '14 at 11:48
  • hello not all the ancestors only the first hidden which is the one who hide the current element, but the is others hidden ancestor (pagination) that i don't want to show, so i realy need to find the first hidden parent – ivan Nov 12 '14 at 12:38

1 Answers1

1

Why not just .show() all ancestor elements that are hidden:

$('input[name="toto"]').parents(":hidden").show();

In fact, why waste time filtering out the :hidden ancestors, when you could just show() all of them?:

$('input[name="toto"]').parents().show();
George
  • 36,413
  • 9
  • 66
  • 103