How Much Does a General Surgeon Make? 2025 Salary Breakdown + Free Career Insights

Ever thought about what makes a surgeon's salary so high in healthcare? I've dug into the world of medical careers and found some surprising facts about general surgery income.

Read more

In 2025, general surgeons are at the top of the medical pay scale. They earn an average of $464,071 a year. This shows how much skill and expertise can pay off. Data from Marit Health, based on over 12,000 clinicians, gives us a clear picture of their earnings.

Read more

The world of general surgery salaries is full of details. Things like specialty, location, and experience affect how much you can earn. Knowing these factors is essential for those interested in this high-paying medical career.

Read more

Our data is checked through the National Provider Identifier (NPI) process. This makes the salary info we share clear and accurate. From starting out to reaching senior roles, the earning possibilities are huge.

Read more

In the next parts, we'll dive into the details of a general surgeon's salary in 2025. We'll cover salary structures and career growth chances.

Read more
  • Understanding the Role of General Surgeons in Modern Healthcare
    • The Importance of Medical Records in Surgery
    • Importance of Accurate Medical Histories
      • Using a Physician Salary and Compensation Database
    • How much do a general surgeon make - Surgical Procedures and Patient Impact
    • Technological Adaptations in Surgery
    • The Role of Healthcare Providers in General Surgery
  • How Much Does a General Surgeon Make in 2025?
  • Medical Specialties and General Surgery Salaries
  • Average Surgeon Salary in 2025
  • Experience Level and Salary Progression
    • Entry-Level Earnings: Building the Foundation
    • Mid-Career Compensation: Growing Professional Value
    • Senior Level Income: Peak Earning
  • Geographical Salary Variations Across the United States
    • Locum Tenens Opportunities for Surgeons
    • Locum Tenens Compensation Trends
    • Addressing the Physician Shortage
  • Components of a General Surgeon's Compensation Package
    • Health Insurance and Surgeon Compensation
    • Performance Bonus Structures
    • Managing Patient Volume in Hospitals
    • Profit Sharing Opportunities
  • Career Investment and Educational Requirements
    • Earning a Medical Degree and Starting a Surgical Career
  • Comparison with Other Surgical Specialties
  • Vascular Surgery vs. General Surgery Salaries
    • Training Duration Differences
    • Exploring Surgical Subspecialties
    • Work-Life Balance Considerations
  • The Role of the Surgical Team
  • Employment Settings and Their Impact on Earnings
    • The Evolving Healthcare Environment for Surgeons
    • Quality Surgical Care and Patient Outcomes
  • Future Outlook and Growth Potencial
    • The Medical Review Institute of America and General Surgery
    • Industry Trends Impacting General Surgery
    • Technological Advancements
    • Career Advancement Opportunities
    • General Surgery Careers at Trident Medical Center
    • The Role of Full-Time Attending General Surgeons
    • The Role of Physician Online Communities
  • 🧠 Expert Summary — by Rodrigo Durães
Read more

Understanding the Role of General Surgeons in Modern Healthcare

General surgeons are vital in today's healthcare world. They do more than just surgery. They handle a wide range of medical tasks that affect patient care and hospital income. Their pay shows how important their skills and duties are.

Read more

General surgeons handle many parts of medical care. Their income comes from several key tasks:

Read more
  • Diagnosing complex medical conditions
  • Performing detailed surgical procedures
  • Managing patient care before and after surgery
  • Working with other healthcare teams
Read more

The Importance of Medical Records in Surgery

Medical records are a critical part of every surgical procedure. They help general surgeons track patient progress, monitor surgical care outcomes, and defend against legal issues if they come up. Detailed and accurate medical records are required for quality assurance and patient safety in every hospital.

Read more

Importance of Accurate Medical Histories

General surgeons rely on complete and accurate medical histories to deliver safe and effective surgical care. Mistakes in medical histories can affect patient outcomes and even impact the surgeon’s reputation and earnings. That’s why every healthcare provider in surgery takes detailed histories before any operation.

Read more

Using a Physician Salary and Compensation Database

A physician salary and compensation database is a great tool for any medical professional who wants to see real salary benchmarks. These databases gather info from hospitals, clinics, and doctors to help general surgeons compare their pay to national and local averages. If you want to negotiate your contract or see how your earnings stack up, check a reliable physician salary and compensation database.

Read more

How much do a general surgeon make - Surgical Procedures and Patient Impact

Read more

General surgeons do a variety of surgeries. From emergency appendectomies to advanced tumor removals, their work is critical. They are trained for complex cases that need precision and quick thinking.

Read more

Technological Adaptations in Surgery

The field of general surgery keeps changing with new tech. Surgeons must learn new methods, like robotic surgery and advanced diagnostics. These changes help patients and can increase what surgeons earn.

Read more

The Role of Healthcare Providers in General Surgery

Healthcare providers work together as a team to give the best care to surgical patients. General surgeons depend on nurses, anesthesiologists, and support staff to keep patient volume steady and improve patient outcomes. Strong teamwork among healthcare providers leads to safer surgeries and better results for everyone involved.

Read more

How Much Does a General Surgeon Make in 2025?

In 2025, the pay for general surgeons is quite impressive. They earn an average of $464,071 per year. This shows how much value they add to healthcare.

Read more

To understand How much do a general surgeon make, we need to look at different aspects. The salary varies based on experience:

Read more
  • Entry-level surgeons make about $393,791 a year.
  • Those in the middle earn around $398,626.
  • More experienced surgeons get paid close to $403,461.
  • Specialists can earn up to $410,230.
  • At the top, surgeons make up to $425,756.
Read more

The salary range for general surgeons is wide. They earn a median of $409,665 per year. This range shows the job's financial flexibility:

Read more
PercentileAnnual SalaryHourly Rate
25th Percentile$377,880$182
Median$409,665$197
75th Percentile$530,346$255
Read more

These numbers show the great financial rewards for general surgeons in 2025. They play a vital role in healthcare and have advanced medical skills.

Read more

Medical Specialties and General Surgery Salaries

There are many medical specialties in healthcare, but general surgery stands out because of its strong salary potential and wide scope of practice. Doctors in different medical specialties see a big gap in income. Compared to other fields, general surgeons earn one of the highest average surgeon salaries, making it a top choice for those wanting a challenging and rewarding career.

Read more

Average Surgeon Salary in 2025

The average surgeon salary in 2025 remains strong, with most general surgeons earning well above $400,000 a year. This makes general surgery one of the top-paying fields in medicine. The average surgeon salary also includes bonuses, profit sharing, and other benefits that increase total compensation.

Read more

Experience Level and Salary Progression

A general surgeon's career grows with their skills and experience. Their pay increases as they move up in their career.

Read more

Knowing how income changes helps doctors and students plan their careers. Let's look at how general surgery income changes at different career stages.

Read more

Entry-Level Earnings: Building the Foundation

At the start, general surgeons earn a bit less. Resident doctors get paid based on their training years:

Read more
  • PGY-1 (First Year): Average annual salary of $63,009
  • PGY-2: Earnings increase to $66,092
  • PGY-3: Reaching $69,136
  • PGY-4: Climbing to $71,979
  • PGY-5: Advancing to $74,786
Read more

Mid-Career Compensation: Growing Professional Value

When surgeons start working on their own, their pay goes up a lot. Those with 3-5 years of experience can make about $302,342 a year.

Read more

Senior Level Income: Peak Earning

Experienced surgeons can earn a lot. Those with over 10 years of experience can make up to $460,000 a year. This shows their high skills and reputation.

Read more

These salary increases show the big rewards of growing in general surgery.

Read more

Geographical Salary Variations Across the United States

Read more

Location is key when looking at what a general surgeon earns. Salaries for surgeons vary a lot across states and cities. This leads to big differences in what doctors can make.

Read more

Locum Tenens Opportunities for Surgeons

Locum tenens is becoming more popular among general surgeons who want flexibility and higher pay. Working locum tenens lets medical professionals fill temporary positions in different hospitals or clinics, often earning above the standard full-time attending general surgeons. Locum tenens compensation can sometimes surpass permanent roles, making it an attractive option for those wanting more control over their schedules and income.

Read more

Looking at surgeon earnings by region shows interesting patterns. Some states pay surgeons a lot more than others:

Read more
  • California leads with average earnings exceeding $500,000
  • New York follows closely with salaries around $480,000
  • Texas offers competitive compensation at approximately $460,000
  • Massachusetts provides attractive earnings near $450,000
  • Florida rounds out the top five with surgeon earnings around $440,000
Read more

Rural areas offer special chances for general surgeons. They might earn less, but they get bonuses and help with loans.

Read more
CityAnnual Surgeon Earnings
San Francisco, CA$558,600
San Jose, CA$560,800
New York, NY$522,000
Boston, MA$501,000
Read more

Surgeons thinking about moving should look at these differences. Knowing what surgeons can earn in different places helps them choose the best career path.

Read more

Locum tenens compensation has risen in recent years, with general surgeons earning more by taking on short-term roles. Surgeons who choose locum tenens positions can negotiate better hourly rates, get travel benefits, and sometimes earn more than those in permanent jobs. Locum tenens compensation is especially attractive for surgeons wanting flexibility or extra income between permanent roles.

Read more

Addressing the Physician Shortage

The physician shortage in the United States has driven up salaries for general surgeons and many other medical professionals. With more demand for surgical care, hospitals compete to attract and keep top surgeons. The ongoing physician shortage is one of the main reasons general surgeon salaries have stayed high in 2025.

Read more

Components of a General Surgeon's Compensation Package

General surgeons earn more than just a base salary. Their compensation packages reflect their vital role in healthcare and their specialized skills.

Read more

The surgeon's compensation includes several financial parts. These parts make up a strong earnings profile:

Read more
  • Base Salary Range: $350,000 to $390,000 annually
  • Performance Bonuses: Up to $15,000 per year
  • Sign-on Bonus: Typically available for new hires
  • Education Debt Reduction: Programs offer up to $200,000 tax-free loan repayment
Read more

Health Insurance and Surgeon Compensation

Health insurance is a key part of any surgeon's compensation package. Most hospitals and clinics include health insurance, dental, and vision coverage in their contracts with general surgeons. These benefits can add a lot of value to the total compensation, protecting surgeons and their families while boosting the attractiveness of the offer.

Read more

Performance Bonus Structures

Performance bonuses are a big chance for general surgeons to boost their earnings. These bonuses depend on:

Read more
  1. Patient satisfaction ratings
  2. Surgical outcomes
  3. Procedural efficiency
  4. Research contributions
Read more

Managing Patient Volume in Hospitals

Patient volume affects how much a general surgeon can earn each year. Hospitals with high patient volume need more surgical care, leading to higher salaries and more chances for bonuses. Managing patient volume is a big part of hospital strategy, especially for general surgery departments.

Read more

Profit Sharing Opportunities

Many surgical practices offer profit sharing. This lets surgeons share in the practice's success. It promotes teamwork and rewards individual effort.

Read more

Compensation packages also include extra benefits like:

Read more
  • Health, dental, and vision insurance
  • Retirement plans with employer contributions
  • Paid time off (26 days annual leave)
  • Support for continuous medical education
Read more

Understanding these complex compensation structures helps general surgeons plan their career finances better.

Read more

Career Investment and Educational Requirements

Read more

Becoming a general surgeon is a big step that takes a lot of time, money, and effort. It's a journey that spans almost a decade of hard work and learning. To earn a good surgeon salary, you must go through a detailed educational process.

Read more

The path to becoming a general surgeon includes several key steps:

Read more
  • Undergraduate Degree: 3-4 years of pre-medical studies
  • Medical School: 4 years of intensive medical education
  • Surgical Residency: 5-7 years of specialized surgical training
  • Optional Fellowship: 1-2 years of subspecialty focus
Read more

Those who want to be general surgeons spend a lot on their education. The whole journey can take 9-15 years. This means big expenses for tuition, living costs, and lost opportunities. These costs can lead to a lot of student loans, affecting how much money you can make early in your career.

Read more

Residency programs offer big benefits that make the long training worth it:

Read more
  1. Early operative exposure
  2. Progressive clinical responsibilities
  3. Comprehensive curriculum including Grand Rounds
  4. Simulation training for board certification
Read more

The big investment in surgical education leads to good pay and career chances in healthcare.

Read more

Earning a Medical Degree and Starting a Surgical Career

To become a general surgeon, you need a medical degree and years of intense training. After getting a medical degree, future surgeons enter residency programs where they learn the skills needed for safe and effective surgical care. The journey is long, but a medical degree opens the door to one of the highest paying careers in healthcare.

Read more

Comparison with Other Surgical Specialties

Exploring surgeon earnings across different medical specialties shows interesting insights. It helps medical students and healthcare professionals make better career choices. General surgeons' salaries are compared to other surgical professionals.

Read more

The salary for different surgical specialties varies a lot. Here are the average annual earnings for top surgical specialties:

Read more
Surgical SpecialtyAverage Annual Salary
Neurosurgeons$600,000 - $800,000
Orthopedic Surgeons$500,000 - $550,000
Plastic Surgeons$500,000
Cardiothoracic Surgeons$490,000
General Surgeons$400,000
ENT Surgeons$390,000
Read more

Vascular Surgery vs. General Surgery Salaries

Vascular surgery is a highly paid subspecialty within the world of surgery. While general surgeons earn high salaries, vascular surgery professionals usually see even higher compensation because of the complexity and demand for these procedures. Comparing general surgeon pay to vascular surgery shows how different surgical subspecialties can impact a doctor's income and career choices.

Read more

Training Duration Differences

The journey to becoming a surgical specialist varies. General surgeons usually go through:

Read more
  • 4 years of medical school
  • 5 years of general surgery residency
  • Potential 1-2 years of fellowship training
Read more

Exploring Surgical Subspecialties

There are many surgical subspecialties within medicine, each with its own pay scale and training. From vascular surgery to orthopaedics, these surgical subspecialties offer doctors a chance to specialise, earn more, and focus on specific patient needs. General surgeons often work with or transition into these fields to boost their earnings and professional growth.

Read more

Work-Life Balance Considerations

Each surgical specialty has its own work-life balance challenges. General surgeons often have more flexible schedules than neurosurgeons or cardiothoracic surgeons. These latter two have more demanding on-call shifts and longer surgeries.

Read more

Even though surgeon earnings vary, general surgeons have a good salary. They also have a wide range of procedures in various medical settings.

Read more

The Role of the Surgical Team

Every successful operation depends on a strong surgical team. General surgeons work closely with nurses, techs, anesthesiologists, and other specialists to deliver safe surgical care. Building a reliable surgical team is essential for improving patient outcomes and making sure surgeries run smoothly.

Read more

Employment Settings and Their Impact on Earnings

Read more

Exploring surgeon compensation, I found that where you work greatly affects your pay. The work environment is key in determining your yearly income and career growth.

Read more

Different work settings offer unique financial chances for general surgeons. Let's look at the main options:

Read more
  • Private Practices: Usually offer the highest earnings, with more control over income
  • Hospital-Based Positions: Provide steady salaries with great benefits
  • Academic Institutions: Have lower base salaries but include research chances
  • Outpatient Surgery Centers: Allow flexible hours and possibly higher pay per procedure
Read more

Where you work also affects your salary. Surgeons in big cities often make more because of higher demand and living costs. Rural areas might offer good pay to draw in skilled doctors.

Read more

My research shows locum tenens jobs can be very profitable. These temporary roles often pay more, like in rural areas. Top places for locum tenens pay are Delaware, Arkansas, Tennessee, and Colorado.

Read more

When thinking about a general surgeon's earnings, look at more than just the base salary. Things like bonuses, profit sharing, and extra benefits can greatly increase your earnings.

Read more

The Evolving Healthcare Environment for Surgeons

The healthcare environment keeps changing, which impacts how much general surgeons earn and how they work. Changes in health insurance policies, hospital budgets, and technology shape the modern healthcare environment. General surgeons must adapt to stay at the top of their field.

Read more

Quality Surgical Care and Patient Outcomes

Quality surgical care is closely linked to patient outcomes. General surgeons who focus on careful pre-op planning, excellent technique, and strong aftercare see better patient outcomes. High patient outcomes also improve a hospital’s reputation and can lead to better bonuses and career opportunities for the surgical team.

Read more

how to become a surgeon

Read more

Future Outlook and Growth Potencial

The world of general surgery is changing fast, opening up new chances for doctors. As healthcare evolves, general surgeons will see their careers grow. They can expect big increases in their income and salary.

Read more

General surgery's future looks bright, thanks to new tech and professional changes. These advancements will boost the field's economic side. For those dedicated to surgery, the future is full of promise.

Read more

The Medical Review Institute of America and General Surgery

The Medical Review Institute of America is known for its research and analysis of surgical care and outcomes. This organisation helps set national benchmarks and guidelines for safe, high-quality surgery. General surgeons often look to the Medical Review Institute of America for updates on best practices and safety standards.

Read more
  • Growing demand for minimally invasive surgical techniques
  • Increased focus on specialized surgical procedures
  • Rising healthcare needs of an aging population
  • Integration of artificial intelligence in surgical planning
Read more

Technological Advancements

New tech is changing general surgery, opening up new ways for doctors to earn more. Robotic surgery, augmented reality, and precise diagnostic tools are making surgery better.

Read more
TechnologyImpact on Surgeon Salary
Robotic Surgery SystemsPotential 15-20% income increase
AI Surgical PlanningImproved efficiency and specialization
Telemedicine IntegrationExpanded patient consultation opportunities
Read more

Career Advancement Opportunities

General surgeons can boost their income by focusing on professional growth. Subspecialty training, leadership roles, and academic medicine are key paths to success.

Read more
  1. Subspecialty fellowship training
  2. Academic research positions
  3. Healthcare administration roles
  4. Telemedicine surgical consultations
Read more

By using new tech and choosing the right career paths, general surgeons can grow a lot. They will thrive in the changing healthcare world.

Read more

General Surgery Careers at Trident Medical Center

Trident Medical Center is a top employer for general surgeons, offering competitive pay, strong health insurance, and career advancement opportunities. Working at Trident Medical Center means joining a respected surgical team and gaining access to the latest medical technology.

Read more

The Role of Full-Time Attending General Surgeons

Full-time attending general surgeons are the backbone of many hospitals. They oversee surgeries, teach junior doctors, and make sure patient care meets the highest standards. Their steady presence and experience are key reasons why hospitals invest so much in their salaries and benefits.

Read more

The Role of Physician Online Communities

Physician online communities give general surgeons a place to discuss salaries, share job tips, and talk about career moves. These communities help doctors swap ideas about locum tenens work, talk about health insurance options, or review trends from the Medscape General Surgeon Compensation Report. Being part of physician online communities can make it easier for surgeons to make smart career decisions.

Read more

🧠 Expert Summary — by Rodrigo Durães

Looking into surgeon earnings, I found the field both complex and rewarding. General surgeons earn an average of $446,900 a year by 2025. Their pay can range from $315,079 to $606,422. This high income shows the hard work, skill, and dedication needed in medicine.

Read more

The amount a general surgeon makes depends on several things. Starting out, they earn around $414,516. Experienced surgeons can make up to $448,164. Where they work also matters, with San Francisco and New York paying over $550,000 a year.

Read more

Surgeon earnings go beyond just their salary. They also get bonuses, benefits, and other perks. Successful surgeons plan their careers well, looking at more than just money. They focus on specialization, learning, and growth to increase their earnings and job satisfaction.

Read more

For those wanting to be surgeons, the future looks bright. With hard work, smart planning, and the right choices, they can have a rewarding career. High pay, respect, and the chance to help others make it a great choice.

Read more

General Surgeon Salary

Read more

FAQ

What is the average salary for a general surgeon in 2025?

Read more

The average salary for a general surgeon in 2025 is expected to be between 350,000 and 600,000. This amount can vary based on experience, location, and where they work.

Read more

Medscape General Surgeon Compensation Report Insights

The Medscape General Surgeon Compensation Report is a trusted source for salary and compensation data. Each year, this report breaks down trends in pay, bonuses, and job satisfaction for full-time attending general surgeons. It’s a must-read for anyone serious about understanding the latest changes in general surgery salaries and how they compare to other surgical subspecialties.

Read more

How long does it take to become a general surgeon?

It takes about 13-15 years to become a general surgeon. This includes a 4-year undergraduate degree, 4 years of medical school, and 5 years of surgical residency. You might also need 1-2 years of fellowship training.

Read more

Do general surgeons earn differently based on their location?

Yes, salaries for general surgeons can change a lot based on where they work. Places with higher costs of living often pay more. But, rural areas might offer lower salaries with better benefits.

Read more

What factors influence a general surgeon's total compensation?

Several things affect a general surgeon's pay. These include how long they've been working, their specialty, where they work, bonuses, profit-sharing, and where they are geographically.

Read more

How do general surgeon salaries compare to other surgical specialties?

General surgeons usually earn a middle salary among surgical specialties. Neurosurgeons and cardiovascular surgeons make more. Pediatric surgery might pay less.

Read more

What additional income opportunities exist for general surgeons?

General surgeons can earn more through bonuses, profit-sharing, consulting, speaking, and developing new surgical techniques. They can also lead in healthcare institutions.

Read more

How has technology impacted general surgeon salaries?

New technology like robotic surgery has opened up chances for general surgeons to earn more. They can develop advanced skills and stand out in their field.

Read more

Are there opportunities for career advancement in general surgery?

Yes, there are many ways for general surgeons to grow in their careers. They can pursue subspecialties, take on leadership roles, do research, innovate, or teach in academic settings.

Read more

What is the job outlook for general surgeons in 2025?

The job outlook for general surgeons is good. Demand is steady due to an aging population and more surgeries. The Bureau of Labor Statistics predicts growth in surgical fields through the mid-2020s.

Read more

What are the most significant challenges in a general surgeon's career?

General surgeons face many challenges. These include long training, high stress, long hours, and keeping up with new tech. They also deal with malpractice risks and balancing work and life.

Read more

.content-engagement-quiz { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background-color: var(--ceq-card-background); color: var(--ceq-text-color); padding: 30px; margin: 25px auto; max-width: 600px; border-radius: var(--ceq-border-radius); box-shadow: var(--ceq-shadow); text-align: center; border-top: 5px solid var(--ceq-primary-color); }

Read more

.ceq-container { animation: ceq-fade-in 0.5s ease-in-out; }

Read more

@keyframes ceq-fade-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

Read more

/* --- Question Section --- */ #ceq-question-container h3 { font-size: 1.6rem; font-weight: 600; margin-top: 0; margin-bottom: 25px; }

Read more

.ceq-answers { display: flex; justify-content: center; gap: 15px; }

Read more

.ceq-answer-btn { background-color: transparent; border: 2px solid #d1d5db; color: var(--ceq-subtle-text); padding: 12px 24px; font-size: 1rem; font-weight: 600; border-radius: 8px; cursor: pointer; transition: all 0.3s ease; }

Read more

.ceq-answer-btn:hover { border-color: var(--ceq-primary-color); color: var(--ceq-primary-color); transform: translateY(-2px); }

Read more

/* --- Next Article Section --- */ #ceq-next-article-container p { font-size: 1.1rem; color: var(--ceq-subtle-text); margin-top: 0; margin-bottom: 20px; }

Read more

.ceq-next-article-btn { display: inline-block; background-color: var(--ceq-success-color); color: white; padding: 16px 32px; font-size: 1.2rem; font-weight: 700; border-radius: 8px; text-decoration: none; transition: background-color 0.3s ease, opacity 0.3s ease; position: relative; }

Read more

.ceq-next-article-btn.disabled { background-color: #9ca3af; cursor: not-allowed; opacity: 0.7; }

Read more

.ceq-timer-text { position: absolute; bottom: -25px; left: 50%; transform: translateX(-50%); font-size: 0.85rem; font-weight: 500; color: var(--ceq-subtle-text); white-space: nowrap; }

Read more

Did you enjoy this content and want more?

Awesome! Your next recommended article is waiting for you.

Read more

Read Next Article

Read more

// --- CONFIGURATION --- // // All user-facing text and settings are here for easy translation and customization. const config = { nextArticleURL: "https://careersforge.com/general-surgeon-salary/", // IMPORTANT: Change this to the actual URL of the next article. timerDuration: 30, // Countdown duration in seconds.

Read more

// Text strings for easy translation questionText: "Did you enjoy this content and want more? ( 2nd post )", yesButtonText: "Yes, I loved it! 👍", noButtonText: "Not this time 👎", waitingText: "Awesome! Your next recommended article is waiting for you.", buttonText: "Read Next Article", buttonDisabledText: "Unlocking in" // This will be followed by the timer, e.g., "Unlocking in 30s" }; // --- END OF CONFIGURATION --- //

Read more

// --- DOM ELEMENTS --- const questionContainer = document.getElementById('ceq-question-container'); const nextArticleContainer = document.getElementById('ceq-next-article-container'); const yesBtn = document.getElementById('ceq-yes-btn'); const noBtn = document.getElementById('ceq-no-btn'); const nextArticleBtn = document.getElementById('ceq-next-article-btn');

Read more

// --- SET TEXT FROM CONFIG --- document.getElementById('ceq-question-text').textContent = config.questionText; yesBtn.textContent = config.yesButtonText; noBtn.textContent = config.noButtonText; document.getElementById('ceq-waiting-text').textContent = config.waitingText; document.getElementById('ceq-button-main-text').textContent = config.buttonText;

Read more

// --- FUNCTIONS --- function startTimer() { let timeLeft = config.timerDuration; const timerTextElement = document.getElementById('ceq-timer-text');

Read more

// Set initial timer text timerTextElement.textContent = `${config.buttonDisabledText} ${timeLeft}s...`;

Read more

const timerInterval = setInterval(() => { timeLeft--; if (timeLeft > 0) { timerTextElement.textContent = `${config.buttonDisabledText} ${timeLeft}s...`; } else { clearInterval(timerInterval); timerTextElement.textContent = ""; // Clear timer textnextArticleBtn.classList.remove('disabled');

Read more

// Remove href to prevent default navigationnextArticleBtn.removeAttribute('href');

Read more

// Adiciona evento para abrir em nova abanextArticleBtn.addEventListener('click', function handler(e) { if (!nextArticleBtn.classList.contains('disabled')) { window.open(config.nextArticleURL, '_blank'); // Opcional: remover o event listener após o clique nextArticleBtn.removeEventListener('click', handler); } else { e.preventDefault(); }}); } }, 1000); }

Read more

function handleAnswerClick() { questionContainer.style.display = 'none'; nextArticleContainer.style.display = 'block'; startTimer(); }

Read more

// --- EVENT LISTENERS --- yesBtn.addEventListener('click', handleAnswerClick); noBtn.addEventListener('click', handleAnswerClick);});

Read more

Did you like this story?

Please share by clicking this button!

Visit our site and see all other available articles!

CareersForge