Could you help me break out a loop of goquery Each looping? I used "return" but it doesn't get out of loop, just pass the iteraction... How can I break out an Each looping in the following code:
doc.Find("td").Each(func(i int, s *goquery.Selection) {
summary := s.Text()
if summary == "--" {
//I want to break the Each loop here
}
}
Use the EachWithBreak
method
doc.Find("td").EachWithBreak(func(i int, s *goquery.Selection) bool {
summary := s.Text()
if summary == "--" {
return false
}
return true
})