What is an easy way to repeat x the number of times with next()
(each time using the same function)?
I work at Sharepoint and have limited control over HTML; I can find the element by its identifier, track the nearest <td>
, hide()
it, and then move on to the next one (I donβt want all <td>
to be around 7 or 8 in a row).
The code below works, but it is not.
$("#my-easily-identifiable-id").closest("td").hide(); $("#my-easily-identifiable-id").closest("td").next().hide(); $("#my-easily-identifiable-id").closest("td").next().next().hide(); $("#my-easily-identifiable-id").closest("td").next().next().next().hide(); [ ... etc ... ]
What is the best way to do this?
thanks
PS: added fiddle (genius)
source share