Smokeless tobacco isn’t mentioned alongside peanuts and Crackerjack in “Take Me Out to the Ballgame.”

But for generations of ballplayers, a cheek full of chew or a tin of snuff tucked in a back pocket has been a standard part of their uniform. And beginning Thursday night at AT&T Park, it will be illegal.

A San Francisco ordinance passed last May bans the use of smokeless tobacco in all athletic facilities within the city. It took effect on Jan. 1. Similar ordinances have been passed in Los Angeles, Boston and New York. And Gov. Jerry Brown in October signed a statewide ban on smokeless tobacco use in the state’s five major league ballparks, including O.Co Coliseum in Oakland, which will be enforced starting in 2017.

The San Francisco ordinance will be on the books Thursday night, when the Giants and A’s play an exhibition game at AT&T Park. How it will be enforced and by whom isn’t yet clear, but the intent is: to make baseball players into better role models, whether they like it or not.

“I can see it from both sides of the fence,” said Giants catcher Buster Posey, who quit dipping three years ago. “You want to be a good example for children, and we are role models. There’s a responsibility there. But at the same time, if they’re telling adults they can or cannot use tobacco products, what’s next?

“I think I have a little bit of an issue with governments telling somebody they can’t use tobacco.”

An anonymous survey of 25 Giants players performed by this news organization this spring found that Posey’s position was overwhelmingly common. While they will comply with the ordinance, they don’t agree with it.

Just two players responded that they would not comply with the law. Yet just three players out of 25 expressed support for it. The survey also revealed that while just seven players have used smokeless tobacco in the past 12 months, 16 answered that they had tried chew or dip — and most of them began experimenting as teenagers.

Chewing isn’t the easiest habit to quit. Some players in Giants camp this spring began chewing gum or Grinds, pouches of flavored coffee grounds, in games to wean them off the relaxation that they get from smokeless tobacco.

There’s no good explanation for why spit tobacco and baseball became so intertwined over the decades. Maybe it’s the down time in between pitches, or that an oral fixation habit fits so well into a routine-oriented game. Whatever the cause, only one player surveyed said that chewing provided any performance-enhancing benefit, and that was because it made his saliva tackier to help him grip the baseball.

“I hate to say it’s synonymous with baseball,” Posey said. “But you’re around it a decent amount.”

Madison Bumgarner, who had a mouth full of snuff while receiving the World Series MVP trophy on live television in 2014, practically grew up in a tobacco field on the North Carolina Piedmont. He said he would abide by the law.

“It’s not going to be tough,” Bumgarner said. “That’s the law and that’s just what you’ve got to do. They’re giving us other options with coffee pouches and the herbal stuff, so I don’t think it’ll be very difficult. It’s only a few hours out of your day when you’re at the field. I don’t necessarily agree with it, but it’s against the law.”

Although, unlike smoking, there is no health issue over secondary spit, Bumgarner said he understood the law was passed to discourage impressionable youths who see their favorite players expectorating on the field.

“But whether it (sets a bad example) or not, I don’t think other people should control how you want to portray yourself,” Bumgarner said.

The push to pass the ordinances began with the Campaign for Tobacco-Free Kids, which chose high-profile baseball cities in its effort to get local and state governments to act after the Major League Players Association wouldn’t accept a complete ban during negotiations as part of the last labor agreement with the league five years ago. San Francisco was targeted because it had just won the World Series when the campaign began.

“We went city by city and ballpark by ballpark,” said John Schachter, campaign spokesman.

San Francisco Supervisor Mark Farrell, who used to use spit tobacco while playing baseball at Loyola Marymount University in Los Angeles, sponsored the bill.

“He grew up around a culture of dipping and then saw the influence it was having on youth,” legislative aide Jess Montejano said.

Farrell, a father of three, coaches one of his son’s baseball teams.

Offenders in San Francisco can be fined up to $100 for a first offense, and up to $250 for a second violation. Those caught breaking the law more than twice within a calendar year risk being fined up to $500.

But Montejano said the penalties are secondary to educating the public and players about the ban, which applies to all city athletic fields.

The Giants plan to post signs at entrances and exits at AT&T Park to explain the new law, which will also apply to patrons. Union officials explained the laws to players on every team in their clubhouse meetings this spring. Still, many players remain hazy on how the law will be enforced and what the penalties will be.

“It’s not like we’re beefing up extra officers,” Montejano added. “But if there are egregious users or people obviously violating the law the officers are within their rights to write-up violations.”

In other words, players aren’t going to be ejected in the midst of competition, handcuffed and taken to a holding area.

Enforcement is more than likely to fall on managers and team personnel as a pre-emptive strike against police intervention. Giants manager Bruce Bochy, who has dipped off and on for most of his adult life, said he did not anticipate any compliance issues with his players.

“The law was passed and we’ll obey the law,” Bochy said. “They won’t be dipping at the ballpark.”

MLB Commissioner Rob Manfred said players “are citizens like any other citizens. Municipalities pass laws. We expect that our players will comply with those laws.”

Manfred said the league would step up its long-standing efforts to provide education and cessation support to players. The program received more inquiries from players in 2014 following the death of popular Hall of Fame player Tony Gwynn after a long battle with salivary gland cancer.

Posey said he didn’t quit because of Gwynn.

“It was really my wife getting on my butt,” said Posey, with a laugh. “She just told me it was time to clean it up. … Then she caught me doing it again, and she kind of threw me under the bus. She said, ‘I thought you were stronger than that.’ And it was, ‘All right, I’m going to prove you wrong, then.’

“That’s kind of my point where I don’t agree with the ordinance,” Posey continued. “I made a decision. I feel like you should be able to make your own decision one way or the other.”