Jennifer Garner Jokes About Ex-Husband Ben Affleck in Surprise 'Deadpool & Wolverine' Cameo

Jennifer Garner and Ben Affleck were married from 2005 to 2018 and share three kids.

Jennifer Garner is poking fun at her ex. The 52-year-old actress makes a surprise cameo in Deadpool & Wolverine, during which she makes a hilarious dig at Ben Affleck, whom she was married to from 2005 to 2018.

In the flick, Garner reprises her role of Elektra, which she first played in Daredevil. Affleck, meanwhile, played the titular role in the 2003 film.

The hilarious Deadpool & Wolverine moment comes when Ryan Reynolds' Deadpool is paying tribute to Marvel characters who haven't survived. When he offers condolences for Daredevil's death, Garner quips, "Oh, it's fine."

Despite the playful quip, Garner and Affleck have remained cordial since their divorce.

In fact, a source told ET in June that the parents of three -- who share Violet, 18, Seraphina, 15, and Samuel, 12 -- have been "co-parenting well" amid Affleck's marital woes with his current wife, Jennifer Lopez

Ben Affleck and Jennifer Garner pose together in 2014. - Jim Spellman/WireImage

Affleck and Lopez tied the knot in 2022, but have had a tumultuous summer, during which they put their $68 million home up for sale and spent big events -- their second wedding anniversary and Lopez's 55th birthday -- apart.

"It has been a hard year with some unexpected realizations, changes, and obstacles, but Jen is trying to view her 55th birthday as a fresh start," a source told ET. "She is trying not to let her situation with Ben bring her down."

Lopez shares 16-year-old twins, Max and Emme, with her ex-husband, Marc Anthony.

"Jen and Ben have been trying to focus on their loved ones while spending time apart," a separate source told ET. "Jen and Ben are both keeping their kids and respective families at the forefront of their minds as they move through these changes. They're trying to present themselves in a positive way for their kids."

RELATED CONTENT: