It was a silent call to arms: an easy-to-overlook message urging New Jersey students to take a stand against the budget cuts that threaten class sizes and choices as well as after-school activities. But some 18,000 students accepted the invitation posted last month on Facebook, the social media site better known for publicizing parties and sporting events. And on Tuesday many of them — and many others — walked out of class in one of the largest grass-roots demonstrations to hit New Jersey in years.

The protest disrupted classroom routines and standardized testing in some of the state’s biggest and best-known school districts, offering a real-life civics lesson that unfolded on lawns, sidewalks, parking lots and football fields.

The mass walkouts were inspired by Michelle Ryan Lauto, an 18-year-old aspiring actress and a college freshman, and came a week after voters rejected 58 percent of school district budgets put to a vote across the state (not all districts have a direct budget vote).

“All I did was make a Facebook page,” said Ms. Lauto, who graduated last year from Northern Valley Regional High School in Old Tappan, N.J. “Anyone who has an opinion could do that and have their opinion heard. I would love to see kids in high school step up and start their own protests and change things in their own way.”