Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • GfG 160: Daily DSA
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Aptitude
  • Engineering Mathematics
  • Discrete Mathematics
  • Operating System
  • DBMS
  • Computer Networks
  • Digital Logic and Design
  • C Programming
  • Data Structures
  • Algorithms
  • Theory of Computation
  • Compiler Design
  • Computer Org and Architecture
Open In App
Next Article:
Number System and Base Conversions
Next article icon

Digital Electronics and Logic Design Tutorials

Last Updated : 26 Mar, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Digital Electronics and Logic Design are key concepts in both electronics and computer science. Digital systems are at the core of everything from basic devices like calculators to advanced computing systems.

  • Digital systems use binary numbers (0s and 1s) to represent and process information.
  • Logic gates like AND, OR and NOT are combined to create circuits that perform logical operations on binary inputs.
  • Combinational circuits produce outputs based only on current inputs, without storing any past information.
  • Sequential circuits use memory elements, such as flip-flops, to store and process information over time.
  • The principles of digital electronics and logic design are fundamental in building processors, memory systems and many other computing applications.

In this Digital Electronics and Logic Design tutorial, we will dive deep into the fundamentals and advanced concepts like the Number System, Logic Gates, Boolean Algebra, Combinational Circuits, Sequential Circuits, etc.

Introduction

  1. What is Digital Electronics and Logic Design?
  2. Difference Between Analog and Digital Systems
  3. Characteristics of Digital Systems

Number System and Representation

  1. Number System and Base Conversions
  2. Binary Number System
  3. Binary Representations
  4. Signed and Unsigned Representation
  5. Gray Code
  6. BCD or Binary Coded Decimal
  7. Excess-3 Code
  8. Octal Number System
  9. Decimal Number System
  10. Hexadecimal Number System
  11. Floating Point Representation
  12. Number System Conversion Programs

>> Quiz on Number System and Representation

Logic Gates

  1. Logic Gates Introduction
  2. AND Gate
  3. OR Gate
  4. NOT Gate
  5. NAND Gate
  6. NOR Gate
  7. XOR Gate
  8. XNOR Gate
  9. Logic Gates using NAND and NOR
  10. Applications of Logic Gates

Boolean Algebra

  1. Boolean Algebra Introduction
  2. Properties of Boolean algebra
  3. Representation of Boolean Functions
  4. Canonical and Standard Form
  5. Sum of Product (SOP) Form
  6. Product of Sum (POS) Form
  7. Functional Completeness
  8. DeMorgan's Theorem

Gate-Level Minimization

  1. Minimization of Boolean Functions
  2. K-Map(Karnaugh Map)
  3. 5 variable K-Map
  4. Don’t Care Conditions
  5. Implicants in K-Map
  6. Quine-McCluskey Method (Tabular Method)
  7. Variable Entrant Map (VEM)
  8. Consensus theorem

>> Quiz on Logic Gates, Boolean Algebra and Minimization

Combinational Circuits

  1. Combinational Circuit Introduction
  2. Half-Adder
  3. Half-Subtractor
  4. Half-Adder and Half-Subtractor using NAND NOR Gates
  5. Full-Adder
  6. Full Subtractor
  7. Parallel Adder & Parallel Subtractor
  8. Carry Look-Ahead Adder
  9. BCD Adder
  10. Code Converters – BCD(8421) to/from Excess-3
  11. Code Converters – Binary to/from Gray Code
  12. Code Converters – BCD to 7 Segment Decoder
  13. Multiplexers
  14. Demultiplexer
  15. Encoders and Decoders
  16. Encoder
  17. Binary Decoder
  18. Combinational circuits using Decoder
  19. Magnitude Comparator
  20. Static Hazards

>> Quiz on Combinational Circuits

Sequential Circuits

  1. Introduction to Sequential Circuits
  2. Difference Between Combinational and Sequential Circuits
  3. Latches
  4. One bit memory cell
  5. Flip-Flops(Types and Conversions)
  6. SR Flip-Flops
  7. JK Flip-Flops
  8. D Flip-Flops
  9. T Flip-Flops
  10. Master Slave JK Flip Flop
  11. Synchronous Sequential Circuits
  12. Asynchronous Sequential Circuits
  13. Synchronous vs Asynchronous Sequential Circuits
  14. State Reduction and State Assignment

>> Quiz on Sequential Circuits

Register and Counters

  1. Registers
  2. Shift Registers
  3. Serial In Serial Out (SISO) Shift Register
  4. Serial In Parallel Out (SIPO) Shift Register
  5. Parallel In Serial Out (PISO) Shift Register
  6. Parallel In Parallel Out (PIPO) Shift Register
  7. Universal Shift Register
  8. Counters
  9. Ripple Counter
  10. Ring Counter
  11. Johnson Counter
  12. Design of Counters for Specific Sequences
  13. Amortized analysis for increment in counter
  14. Registers Vs Counters
  15. RTL (Register Transfer Level) design vs Sequential logic design

Memory and Programmable Logic

  1. Read-Only Memory (ROM)
  2. Random Access Memory (RAM)
  3. RAM vs ROM
  4. Programmable Logic Array
  5. Programming Array Logic
  6. Field-Programmable Gate Arrays (FPGAs)
  7. Logic Family
  8. Operational Amplifier (op-amp)

Hardware Description Languages (HDLs)

  1. Hardware Description Language
  2. Introduction to Verilog
  3. Verilog Data Types
  4. Introduction to VHDL
  5. HDL Model of Combinational Circuits
  6. HDL Model of Sequential Circuits

Data Communication

  1. Data Communication
  2. Block Coding
  3. Difference between Unipolar, Polar and Bipolar Line Coding
  4. Difference between Broadband and Baseband Transmission
  5. Transmission Impairment
  6. What is Scrambling?
  7. Analog to Analog Conversion (Modulation)
  8. Analog to digital conversion
  9. Digital to Analog Conversion

Quick Links:

  • Last Minute Notes (LMNs)
  • Quizzes on Digital Electronics and Logic Design

Next Article
Number System and Base Conversions
author
kartik
Improve
Article Tags :
  • Digital Logic

Similar Reads

  • Digital Electronics and Logic Design Tutorials
    Digital Electronics and Logic Design are key concepts in both electronics and computer science. Digital systems are at the core of everything from basic devices like calculators to advanced computing systems. Digital systems use binary numbers (0s and 1s) to represent and process information.Logic g
    4 min read
  • Number Systems

    • Number System and Base Conversions
      Electronic and digital systems use various number systems such as Decimal, Binary, Hexadecimal and Octal, which are essential in computing. Binary (base-2) is the foundation of digital systems.Hexadecimal (base-16) and Octal (base-8) are commonly used to simplify the representation of binary data. T
      9 min read

    • 1's and 2's complement of a Binary Number
      Given a binary number s represented as a string. The task is to return its 1's complement and 2's complement in form of an array as [onesComplement, twosComplement].The 1's complement of a binary number is obtained by flipping all its bits. 0 becomes 1, and 1 becomes 0. Positive numbers remain uncha
      8 min read

    • BCD or Binary Coded Decimal
      Binary Coded Decimal (BCD) is a binary encoding system in which each decimal digit is represented by a fixed number of binary bits, typically four. Instead of converting the entire decimal number into a binary number, BCD represents each decimal digit separately as its binary equivalent. BCD powers
      6 min read

    • Error Detection Codes: Parity Bit Method
      Error Detection Codes: The binary information is transferred from one location to another location through some communication medium. The external noise can change bits from 1 to 0 or 0 to 1. This change in values changes the meaning of the actual message and is called an error. For efficient data t
      6 min read

    Boolean Algebra and Logic Gates

    • Logic Gates - Definition, Types, Uses
      Logic Gates are the fundamental building blocks in digital electronics. There are basically seven main types of logic gates that are used to perform various logical operations in digital systems. By combining different logic gates, complex operations are performed, and circuits like flip-flops, coun
      10 min read

    • Basic Conversion of Logic Gates
      In the Digital System, logic gates are the basic building blocks.  In these logic gates, we can find the gates having more than one input, but will have only one output. The connection between the input and the output of a gate is based on some logic. Based on this logic, different gates are develop
      6 min read

    • Realization of Logic Gate Using Universal gates
      In Boolean Algebra, the NAND and NOR gates are called universal gates because any digital circuit can be implemented by using any one of these two i.e. any logic gate can be created using NAND or NOR gates only.Implementation of AND Gate using Universal GatesImplementation using NAND GatesThe AND ga
      6 min read

    • Canonical and Standard Form
      Canonical Form - In Boolean algebra, the Boolean function can be expressed as Canonical Disjunctive Normal Form known as minterm and some are expressed as Canonical Conjunctive Normal Form known as maxterm. In Minterm, we look for the functions where the output results in "1" while in Maxterm we loo
      6 min read

    • Types of Integrated Circuits
      In this article, we will go through the Types of Integrated Circuits, we will start our article with the introductions of the ICs, then we will go through different types of ICs one by one, At last, we will conclude our article will their applications, advantages, disadvantages and some FAQs. Table
      7 min read

    Minimization Techniques

    • Minimization of Boolean Functions
      Boolean functions are used to represent logical expressions in terms of sum of minterms or product of maxterms. Number of these literals (minterms or maxterms) increases as the complexity of the digital circuit increases. This can lead to large and inefficient circuits. By minimizing Boolean functio
      4 min read

    • Introduction of K-Map (Karnaugh Map)
      In many digital circuits and practical problems, we need to find expressions with minimum variables. We can minimize Boolean expressions of 3, 4 variables very easily using K-map without using any Boolean algebra theorems. It is a tool which is used in digital logic to simplify boolean expression. I
      5 min read

    • 5 variable K-Map in Digital Logic
      Prerequisite - Implicant in K-Map Karnaugh Map or K-Map is an alternative way to write a truth table and is used for the simplification of Boolean Expressions. So far we are familiar with 3 variable K-Map & 4 variable K-Map. Now, let us discuss the 5-variable K-Map in detail. Any Boolean Express
      5 min read

    • Various Implicants in K-Map
      An implicant can be defined as a product/minterm term in Sum of Products (SOP) or sum/maxterm term in Product of Sums (POS) of a Boolean function. For example, consider a Boolean function, F = AB + ABC + BC. Implicants are AB, ABC, and BC. There are various implicant in K-Map listed below :Prime Imp
      5 min read

    • Don't Care (X) Conditions in K-Maps
      One of the most important concepts in simplifying output expressions using Karnaugh Maps (K-Maps) is the 'Don't Care' condition. The 'Don't Care' conditions allow us to treat certain cells in a K-Map as either 0, 1, or to ignore them altogether, which can help in forming larger and more efficient gr
      4 min read

    • Quine McCluskey Method
      The Quine McCluskey method also called the tabulation method is a very useful and convenient method for simplification of the Boolean functions for a large number of variables (greater than 4). This method is useful over K-map when the number of variables is larger for which K-map formation is diffi
      8 min read

    • Two Level Implementation of Logic Gates
      The term "two-level logic" refers to a logic design that uses no more than two logic gates between input and output. This does not mean that the entire design will only have two logic gates, but it does mean that the single path from input to output will only have two logic gates.In two-level logic,
      9 min read

    Combinational Circuits

    • Half Adder in Digital Logic
      A half adder is a combinational logic circuit that performs binary addition of two single-bit inputs, A and B, producing two outputs: SUM and CARRY. The SUM output which is the least significant bit (LSB) is obtained using an XOR gate while the CARRY output which is the most significant bit (MSB) is
      3 min read

    • Full Adder in Digital Logic
      Full Adder is a combinational circuit that adds three inputs and produces two outputs. The first two inputs are A and B and the third input is an input carry as C-IN. The output carry is designated as C-OUT and the normal output is designated as S which is SUM. The C-OUT is also known as the majorit
      5 min read

    • Half Subtractor in Digital Logic
      A half subtractor is a digital logic circuit that performs the binary subtraction of two single-bit binary numbers. It has two inputs, A and B, and two outputs, Difference and Borrow. The Difference output represents the result of subtracting B from A, while the Borrow output indicates whether a bor
      4 min read

    • Full Subtractor in Digital Logic
      A Full Subtractor is a combinational circuit used to perform binary subtraction. It has three inputs:A (Minuend)B (Subtrahend)B-IN (Borrow-in from the previous stage)It produces two outputs:Difference (D): The result of the subtraction.Borrow-out (B-OUT): Indicates if a borrow is needed for the next
      3 min read

    • Parallel Adder and Parallel Subtractor
      An adder adds two binary numbers one bit at a time using carry from each step. A subtractor subtracts one binary number from another using borrow when needed. A parallel adder adds all bits at once, making addition faster. Similarly, a parallel subtractor subtracts all bits at the same time for quic
      5 min read

    • Sequential Binary Multiplier
      In this article, we are going to learn how a sequential binary multiplier works with examples. So for that, we also need to learn a few concepts related to the sequential circuit, binary multipliers, etc. Finally solving the examples using a sequential binary multiplier method.Sequential CircuitA se
      12 min read

    • Multiplexers in Digital Logic
      In this article we will go through the multiplexer, we will first define what is a multiplexer then we will go through its types which are 2x1 and 4x1, then we will go through the Implementation of the 2x1 mux and higher mux with lower order mux, at last we will conclude our article with some applic
      10 min read

    • Event Demultiplexer in Node.js
      Node.js is designed to handle multiple tasks efficiently using asynchronous, non-blocking I/O operations. But how does it manage multiple operations without slowing down or blocking execution? The answer lies in the Event Demultiplexer.The Event Demultiplexer is a key component of Node.js's event-dr
      3 min read

    • Binary Decoder in Digital Logic
      A binary decoder is a digital circuit used to convert binary-coded inputs into a unique set of outputs. It does the opposite of what an encoder does. A decoder takes a binary value (such as 0010) and activates exactly one output line corresponding to that value while all other output lines remain in
      5 min read

    • Encoder in Digital Logic
      An encoder is a digital circuit that converts a set of binary inputs into a unique binary code. The binary code represents the position of the input and is used to identify the specific input that is active. Encoders are commonly used in digital systems to convert a parallel set of inputs into a ser
      7 min read

    • Code Converters - Binary to/from Gray Code
      In this article, we will go through Code Converters - Binary to/from Gray Code, we will start our article by defining Code converters, Binary code and Gray code, and then we will go through the conversion of binary code to gray code and vice versa.Table Of ContentCode ConvertersBinary CodeGray CodeC
      5 min read

    • Magnitude Comparator in Digital Logic
      A magnitude digital Comparator is a combinational circuit that compares two digital or binary numbers in order to find out whether one binary number is equal, less than, or greater than the other binary number. We logically design a circuit for which we will have two inputs one for A and the other f
      7 min read

    Sequential Circuits

    • Introduction of Sequential Circuits
      Sequential circuits are digital circuits that store and use the previous state information to determine their next state. Unlike combinational circuits, which only depend on the current input values to produce outputs, sequential circuits depend on both the current inputs and the previous state stor
      7 min read

    • Difference between Combinational and Sequential Circuit
      In digital electronics, circuits are classified into two primary categories: The combinational circuits and the sequential circuits. Where the outputs depend on the current inputs are called combination circuit, combinational circuits are simple and effective for functions like addition, subtraction
      4 min read

    • Latches in Digital Logic
      Latch is a digital circuit which converts its output according to its inputs instantly. To implement latches, we use different logic gates. In this article, we will see the definition of latches, latch types like SR, gated SR, D, gated D, JK and T with its truth table and diagrams and advantages and
      7 min read

    • Flip-Flop types, their Conversion and Applications
      In this article, we will go through the Flip-Flop types, their Conversion and their Applications, First, we will go through the definition of the flip-flop with its types in brief, and then we will go through the conversion of the flip-flop with its applications, At last, we will conclude our articl
      7 min read

    Conversion of Flip-Flop

    • Conversion of S-R Flip-Flop into D Flip-Flop
      Prerequisite - Flip-flop1. S-R Flip-Flop : S-R flip-flop is similar to S-R latch expect clock signal and two AND gates. The circuit responds to the positive edge of clock pulse to the inputs S and R. 2. D Flip-Flop : D Flip-Flop is a modified SR flip-flop which has an additional inverter. It prevent
      1 min read

    • Conversion of S-R Flip-Flop into T Flip-Flop
      Prerequisite - Flip-flop Here, we will discuss the process of conversion of S-R Flip-Flop into a T Flip-Flop using an example. Rules for conversion: Step-1: Find the characteristics table of required flip-flop and the excitation table of the existing (given) flip-flop. Step-2: Find the expression of
      1 min read

    • Conversion of J-K Flip-Flop into T Flip-Flop
      Prerequisite - Flip-flop 1. J-K Flip-Flop: JK flip-flop shares the initials of Jack Kilby, who won a Nobel prize for his fabrication of the world's first integrated circuit, some people speculate that this type of flip flop was named after him because a flip-flop was the first device that Kilby buil
      1 min read

    • Conversion of J-K Flip-Flop into D Flip-Flop
      A flip-flop is a basic component of digital electronics. This kind of circuit has two stable states and is frequently used in storing one bit of information. Various flip-flops such as SR (Set-Reset), D (Data or Delay), JK and T belong to this category. Each category has distinct features and functi
      4 min read

    Register, Counter, and Memory Unit

    • Counters in Digital Logic
      A Counter is a device which stores (and sometimes displays) the number of times a particular event or process has occurred, often in relationship to a clock signal. Counters are used in digital electronics for counting purpose, they can count specific event happening in the circuit. For example, in
      4 min read

    • Ripple Counter in Digital Logic
      Counters play a crucial role in digital logic circuits, enabling tasks such as clock frequency division and sequencing. This article explores the concept of ripple counters, a type of asynchronous counter, their operation, advantages, and disadvantages in digital logic design. What is a Counter?Coun
      5 min read

    • Ring Counter in Digital Logic
      A ring counter is a typical application of the Shift register. The ring counter is almost the same as the shift counter. The only change is that the output of the last flip-flop is connected to the input of the first flip-flop in the case of the ring counter but in the case of the shift register it
      7 min read

    • General Purpose Registers
      A register is a collection of flip-flops. Single bit digital data is stored using flip-flops. By combining many flip-flops, the storage capacity can be extended to accommodate a huge number of bits. We must utilize an n-bit register with n flip flops if we wish to store an n-bit word.General Purpose
      8 min read

    • Shift Registers in Digital Logic
      Pre-Requisite: Flip-FlopsFlip flops can be used to store a single bit of binary data (1 or 0). However, in order to store multiple bits of data, we need multiple flip-flops. N flip flops are to be connected in order to store n bits of data. A Register is a device that is used to store such informati
      8 min read

    • Computer Memory
      Computer memory is just like the human brain. It is used to store data/information, and instructions. It is a data storage unit or a data storage device where data is to be processed, and instructions required for processing are stored. Both the input and output can be stored here.It's faster than s
      9 min read

    • Random Access Memory (RAM)
      Random Access Memory (RAM) is a type of computer memory that stores data temporarily. When you turn off your computer, the data in RAM disappears, unlike the data on your hard drive, which stays saved. RAM helps your computer run programs and process information faster. This is similar to how the br
      11 min read

    • Read Only Memory (ROM)
      Memory plays a crucial role in how devices operate, and one of the most important types is Read-Only Memory (ROM). Unlike RAM (Random Access Memory), which loses its data when the power is turned off, ROM is designed to store essential information permanently.Here, we’ll explore what ROM is, how it
      8 min read

    LMNs and GATE PYQs

    • LMN - Digital Electronics
      Digital electronics deals with systems that use digital signals, represented as 0s and 1s, to process information. It is the backbone of modern devices like computers, smartphones, and calculators. Unlike analog electronics, which works with continuous signals, digital electronics offers higher accu
      14 min read

    • Digital Logic and Design - GATE CSE Previous Year Questions
      The Digital Logic and Design(DLD) subject has high importance in GATE CSE exam because:moderate number of questions nearly 6-7% of the total papersignificant weightage (6-7 marks) across multiple years This can be seen in the table given below:YearApprox. Marks from Digital LogicNumber of QuestionsD
      2 min read

    Practice Questions - Digital Logic & Design

    geeksforgeeks-footer-logo
    Corporate & Communications Address:
    A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
    Registered Address:
    K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
    GFG App on Play Store GFG App on App Store
    Advertise with us
    • Company
    • About Us
    • Legal
    • Privacy Policy
    • In Media
    • Contact Us
    • Advertise with us
    • GFG Corporate Solution
    • Placement Training Program
    • Languages
    • Python
    • Java
    • C++
    • PHP
    • GoLang
    • SQL
    • R Language
    • Android Tutorial
    • Tutorials Archive
    • DSA
    • Data Structures
    • Algorithms
    • DSA for Beginners
    • Basic DSA Problems
    • DSA Roadmap
    • Top 100 DSA Interview Problems
    • DSA Roadmap by Sandeep Jain
    • All Cheat Sheets
    • Data Science & ML
    • Data Science With Python
    • Data Science For Beginner
    • Machine Learning
    • ML Maths
    • Data Visualisation
    • Pandas
    • NumPy
    • NLP
    • Deep Learning
    • Web Technologies
    • HTML
    • CSS
    • JavaScript
    • TypeScript
    • ReactJS
    • NextJS
    • Bootstrap
    • Web Design
    • Python Tutorial
    • Python Programming Examples
    • Python Projects
    • Python Tkinter
    • Python Web Scraping
    • OpenCV Tutorial
    • Python Interview Question
    • Django
    • Computer Science
    • Operating Systems
    • Computer Network
    • Database Management System
    • Software Engineering
    • Digital Logic Design
    • Engineering Maths
    • Software Development
    • Software Testing
    • DevOps
    • Git
    • Linux
    • AWS
    • Docker
    • Kubernetes
    • Azure
    • GCP
    • DevOps Roadmap
    • System Design
    • High Level Design
    • Low Level Design
    • UML Diagrams
    • Interview Guide
    • Design Patterns
    • OOAD
    • System Design Bootcamp
    • Interview Questions
    • Inteview Preparation
    • Competitive Programming
    • Top DS or Algo for CP
    • Company-Wise Recruitment Process
    • Company-Wise Preparation
    • Aptitude Preparation
    • Puzzles
    • School Subjects
    • Mathematics
    • Physics
    • Chemistry
    • Biology
    • Social Science
    • English Grammar
    • Commerce
    • World GK
    • GeeksforGeeks Videos
    • DSA
    • Python
    • Java
    • C++
    • Web Development
    • Data Science
    • CS Subjects
    @GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
    We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
    Lightbox
    Improvement
    Suggest Changes
    Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
    geeksforgeeks-suggest-icon
    Create Improvement
    Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
    geeksforgeeks-improvement-icon
    Suggest Changes
    min 4 words, max Words Limit:1000

    Thank You!

    Your suggestions are valuable to us.

    '); // $('.spinner-loading-overlay').show(); let script = document.createElement('script'); script.src = 'https://assets.geeksforgeeks.org/v2/editor-prod/static/js/bundle.min.js'; script.defer = true document.head.appendChild(script); script.onload = function() { suggestionModalEditor() //to add editor in suggestion modal if(loginData && loginData.premiumConsent){ personalNoteEditor() //to load editor in personal note } } script.onerror = function() { if($('.editorError').length){ $('.editorError').remove(); } var messageDiv = $('
    ').text('Editor not loaded due to some issues'); $('#suggestion-section-textarea').append(messageDiv); $('.suggest-bottom-btn').hide(); $('.suggestion-section').hide(); editorLoaded = false; } }); //suggestion modal editor function suggestionModalEditor(){ // editor params const params = { data: undefined, plugins: ["BOLD", "ITALIC", "UNDERLINE", "PREBLOCK"], } // loading editor try { suggestEditorInstance = new GFGEditorWrapper("suggestion-section-textarea", params, { appNode: true }) suggestEditorInstance._createEditor("") $('.spinner-loading-overlay:eq(0)').remove(); editorLoaded = true; } catch (error) { $('.spinner-loading-overlay:eq(0)').remove(); editorLoaded = false; } } //personal note editor function personalNoteEditor(){ // editor params const params = { data: undefined, plugins: ["UNDO", "REDO", "BOLD", "ITALIC", "NUMBERED_LIST", "BULLET_LIST", "TEXTALIGNMENTDROPDOWN"], placeholderText: "Description to be......", } // loading editor try { let notesEditorInstance = new GFGEditorWrapper("pn-editor", params, { appNode: true }) notesEditorInstance._createEditor(loginData&&loginData.user_personal_note?loginData.user_personal_note:"") $('.spinner-loading-overlay:eq(0)').remove(); editorLoaded = true; } catch (error) { $('.spinner-loading-overlay:eq(0)').remove(); editorLoaded = false; } } var lockedCasesHtml = `You can suggest the changes for now and it will be under 'My Suggestions' Tab on Write.

    You will be notified via email once the article is available for improvement. Thank you for your valuable feedback!`; var badgesRequiredHtml = `It seems that you do not meet the eligibility criteria to create improvements for this article, as only users who have earned specific badges are permitted to do so.

    However, you can still create improvements through the Pick for Improvement section.`; jQuery('.improve-header-sec-child').on('click', function(){ jQuery('.improve-modal--overlay').hide(); $('.improve-modal--suggestion').hide(); jQuery('#suggestion-modal-alert').hide(); }); $('.suggest-change_wrapper, .locked-status--impove-modal .improve-bottom-btn').on('click',function(){ // when suggest changes option is clicked $('.ContentEditable__root').text(""); $('.suggest-bottom-btn').html("Suggest changes"); $('.thank-you-message').css("display","none"); $('.improve-modal--improvement').hide(); $('.improve-modal--suggestion').show(); $('#suggestion-section-textarea').show(); jQuery('#suggestion-modal-alert').hide(); if(suggestEditorInstance !== null){ suggestEditorInstance.setEditorValue(""); } $('.suggestion-section').css('display', 'block'); jQuery('.suggest-bottom-btn').css("display","block"); }); $('.create-improvement_wrapper').on('click',function(){ // when create improvement option clicked then improvement reason will be shown if(loginData && loginData.isLoggedIn) { $('body').append('
    '); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.unlocked-status--improve-modal-content').css("display","none"); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { showErrorMessage(e.responseJSON,e.status) }, }); } else { if(loginData && !loginData.isLoggedIn) { $('.improve-modal--overlay').hide(); if ($('.header-main__wrapper').find('.header-main__signup.login-modal-btn').length) { $('.header-main__wrapper').find('.header-main__signup.login-modal-btn').click(); } return; } } }); $('.left-arrow-icon_wrapper').on('click',function(){ if($('.improve-modal--suggestion').is(":visible")) $('.improve-modal--suggestion').hide(); else{ } $('.improve-modal--improvement').show(); }); const showErrorMessage = (result,statusCode) => { if(!result) return; $('.spinner-loading-overlay:eq(0)').remove(); if(statusCode == 403) { $('.improve-modal--improve-content.error-message').html(result.message); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); return; } } function suggestionCall() { var editorValue = suggestEditorInstance.getValue(); var suggest_val = $(".ContentEditable__root").find("[data-lexical-text='true']").map(function() { return $(this).text().trim(); }).get().join(' '); suggest_val = suggest_val.replace(/\s+/g, ' ').trim(); var array_String= suggest_val.split(" ") //array of words var gCaptchaToken = $("#g-recaptcha-response-suggestion-form").val(); var error_msg = false; if(suggest_val != "" && array_String.length >=4){ if(editorValue.length <= 2000){ var payload = { "gfg_post_id" : `${post_id}`, "suggestion" : `${editorValue}`, } if(!loginData || !loginData.isLoggedIn) // User is not logged in payload["g-recaptcha-token"] = gCaptchaToken jQuery.ajax({ type:'post', url: "https://apiwrite.geeksforgeeks.org/suggestions/auth/create/", xhrFields: { withCredentials: true }, crossDomain: true, contentType:'application/json', data: JSON.stringify(payload), success:function(data) { if(!loginData || !loginData.isLoggedIn) { grecaptcha.reset(); } jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('.suggest-bottom-btn').css("display","none"); $('#suggestion-section-textarea').hide() $('.thank-you-message').css('display', 'flex'); $('.suggestion-section').css('display', 'none'); jQuery('#suggestion-modal-alert').hide(); }, error:function(data) { if(!loginData || !loginData.isLoggedIn) { grecaptcha.reset(); } jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Something went wrong."); jQuery('#suggestion-modal-alert').show(); error_msg = true; } }); } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Minimum 4 Words and Maximum Words limit is 1000."); jQuery('#suggestion-modal-alert').show(); jQuery('.ContentEditable__root').focus(); error_msg = true; } } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Enter atleast four words !"); jQuery('#suggestion-modal-alert').show(); jQuery('.ContentEditable__root').focus(); error_msg = true; } if(error_msg){ setTimeout(() => { jQuery('.ContentEditable__root').focus(); jQuery('#suggestion-modal-alert').hide(); }, 3000); } } document.querySelector('.suggest-bottom-btn').addEventListener('click', function(){ jQuery('body').append('
    '); jQuery('.spinner-loading-overlay').show(); if(loginData && loginData.isLoggedIn) { suggestionCall(); return; } // script for grecaptcha loaded in loginmodal.html and call function to set the token setGoogleRecaptcha(); }); $('.improvement-bottom-btn.create-improvement-btn').click(function() { //create improvement button is clicked $('body').append('
    '); $('.spinner-loading-overlay').show(); // send this option via create-improvement-post api jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { showErrorMessage(e.responseJSON,e.status); }, }); });
    "For an ad-free experience and exclusive features, subscribe to our Premium Plan!"
    Continue without supporting
    `; $('body').append(adBlockerModal); $('body').addClass('body-for-ad-blocker'); const modal = document.getElementById("adBlockerModal"); modal.style.display = "block"; } function handleAdBlockerClick(type){ if(type == 'disabled'){ window.location.reload(); } else if(type == 'info'){ document.getElementById("ad-blocker-div").style.display = "none"; document.getElementById("ad-blocker-info-div").style.display = "flex"; handleAdBlockerIconClick(0); } } var lastSelected= null; //Mapping of name and video URL with the index. const adBlockerVideoMap = [ ['Ad Block Plus','https://media.geeksforgeeks.org/auth-dashboard-uploads/abp-blocker-min.mp4'], ['Ad Block','https://media.geeksforgeeks.org/auth-dashboard-uploads/Ad-block-min.mp4'], ['uBlock Origin','https://media.geeksforgeeks.org/auth-dashboard-uploads/ub-blocke-min.mp4'], ['uBlock','https://media.geeksforgeeks.org/auth-dashboard-uploads/U-blocker-min.mp4'], ] function handleAdBlockerIconClick(currSelected){ const videocontainer = document.getElementById('ad-blocker-info-div-gif'); const videosource = document.getElementById('ad-blocker-info-div-gif-src'); if(lastSelected != null){ document.getElementById("ad-blocker-info-div-icons-"+lastSelected).style.backgroundColor = "white"; document.getElementById("ad-blocker-info-div-icons-"+lastSelected).style.borderColor = "#D6D6D6"; } document.getElementById("ad-blocker-info-div-icons-"+currSelected).style.backgroundColor = "#D9D9D9"; document.getElementById("ad-blocker-info-div-icons-"+currSelected).style.borderColor = "#848484"; document.getElementById('ad-blocker-info-div-name-span').innerHTML = adBlockerVideoMap[currSelected][0] videocontainer.pause(); videosource.setAttribute('src', adBlockerVideoMap[currSelected][1]); videocontainer.load(); videocontainer.play(); lastSelected = currSelected; }

    What kind of Experience do you want to share?

    Interview Experiences
    Admission Experiences
    Career Journeys
    Work Experiences
    Campus Experiences
    Competitive Exam Experiences