Landlord vs Tenant Rights in India 2026: Complete Legal Guide for Tenants and Owners
EduLaw EditorialCitizen's PlaybookLandlord rights, tenant rights, rent agreement, eviction, security deposit explained for India 2026. Practical, state-aware legal guide for tenants & owners.
⚖ EduLaw Landlord vs Tenant Rights in India 2026: Complete Legal Guide for Tenants and Owners A practical, legally careful guide to rent agreements, eviction, security deposits, repairs and dispute resolution — for tenants, landlords, students, families, working professionals, NRIs and first-time owners. Updated: 19 June 2026 ⏱ ~22 min read India · State-aware Disclaimer: This guide is for legal awareness and education only. Landlord-tenant law in India varies by state, property type, agreement terms and facts. It is not legal advice. Please consult a qualified lawyer before taking any legal action. On this page Why rent disputes happen 1. No single rent law 2. Rent agreement, annotated 3. Tenant rights 4. Landlord rights 5. Security deposit disputes 6. Eviction law 7. Who pays for repairs? 8. Police or civil case? 9. State-wise caution 10. Checklists Important court principles Rights comparison What should I do? FAQs Sources Rent disputes in India usually begin with one sentence: “The owner is asking me to vacate immediately” or “The tenant is not leaving my property.” But landlord-tenant law in India is not that simple, and acting on that one sentence alone is exactly how people get into legal trouble. These disputes are common for a simple reason: renting touches money, shelter and emotion all at once. A landlord worries about damage, delayed rent and getting their property back. A tenant worries about a sudden eviction, a withheld deposit, or a lock that has been changed while they were at work. Both sides feel they are “obviously” right — and both sides are often working from half-understood rules they heard from a relative, a broker, or a social media reel. The deeper problem is that both sides usually misunderstand the law. Many landlords believe ownership alone gives them an instant right to throw a tenant out. Many tenants believe that long occupation, or simply paying rent, gives them strong, permanent protection. Neither belief is reliable. What actually governs the relationship is a combination of the written agreement, the central statutes that supply default rules, and — critically — the rent or tenancy law of the specific state. State laws matter more than most people realise. Housing and rent control sit in the State List of the Constitution, so each state can — and does — make its own rules. A rule that protects a tenant strongly in one city may not exist in the same form in another. This is why no honest guide can tell you that “one rule applies everywhere in India.” Written agreements matter because they fill the gaps the law leaves open: notice period, lock-in, deposit, repairs, subletting and how disputes are handled. A clear, properly executed (and where required, registered) agreement is the single best protection for both parties. A vague WhatsApp understanding is the opposite. Illegal self-help eviction is risky. Even when a tenant is clearly in the wrong, a landlord who breaks the lock, removes belongings, hires muscle, or cuts off electricity and water is stepping outside the law. Indian courts have repeatedly held that a person in settled possession cannot be dispossessed except through due process. Self-help can convert a winnable civil case into a situation where the landlord faces criminal complaints. At the same time, tenants cannot misuse possession. Refusing to pay rent, overstaying after lawful termination, damaging the property, or subletting without permission are not “rights.” They expose the tenant to lawful eviction and to claims for arrears and damages. Possession is protected from force , not from law . This guide walks through both sides carefully — what the law generally says, where it depends on your state and agreement, and what practical steps protect you. Throughout, you will see careful language like “generally,” “subject to agreement and state law,” and “check your state law before acting.” That caution is deliberate. In Indian rental law, the details decide the case. Section 1: India Does Not Have One Single Rent Law There is no single, uniform statute that decides every landlord-tenant question across India. Instead, several layers work together, and which layer dominates depends on your state, your property and your agreement. Central principles. The Transfer of Property Act, 1882 supplies general principles of leases — what a lease is, the rights and liabilities of lessor and lessee (Section 108), and default notice rules for termination (Section 106) where there is no contract, local law or usage to the contrary. The Registration Act, 1908 governs when a lease document must be registered. The Indian Contract Act, 1872 underpins the agreement itself. State rent laws and rent control. Most states have their own Rent Control or tenancy legislation dealing with permissible rent, grounds and procedure for eviction, and tenant protection. These are state-specific and frequently the most decisive layer. Contractual terms. Within the limits of the law, the agreement you sign controls many practical questions — lock-in, notice period, deposit, repairs and subletting. The Model Tenancy Act, 2021 — and its limits. The Union Cabinet approved the Model Tenancy Act (MTA) on 2 June 2021 and circulated it to states and union territories for adoption. It is a model framework , not a self-executing pan-India law. Because housing is a state subject, the MTA applies only where a state or UT actually enacts or notifies it (in full or with modifications). Do not assume MTA provisions — such as its deposit caps or its Rent Authority / Rent Court / Rent Tribunal structure — automatically apply to your tenancy. Check whether your state has adopted it. Legal Source What It Covers Applies Everywhere? Transfer of Property Act, 1882 Lease principles, rights/liabilities, notice where applicable Broadly, subject to local law/contract Registration Act, 1908 Registration of documents (incl. certain leases) Yes, with state stamp rules State Rent Acts Rent control, eviction grounds, tenant protection State-specific Model Tenancy Act, 2021 Model framework (deposits, dispute bodies, duties) Only where adopted/implemented Section 2: Rent Agreement Explained — With Annotations Below is a realistic, simplified excerpt of a residential rent agreement. The dashed box is the clause; the highlighted box beneath explains what it means and what to watch for. (Illustrative only — not a template for use without legal review.) “This Leave & Licence / Rent Agreement is made on 01.07.2026 between Mr. A. Sharma (Owner/Licensor) and Ms. R. Iyer (Tenant/Licensee)…” Parties: Both names must match valid government ID. Verify the owner is the real owner (or an authorised representative). For an NRI owner, check who is authorised to sign and receive rent (often via a Power of Attorney). “…in respect of Flat No. 4B, Maple Residency, [full address], admeasuring approx. 720 sq ft, with 1 covered parking…” Property description: The premises must be described precisely — flat number, address, area, parking, and what is included (furniture, appliances). Vagueness here causes deposit and handover fights later. “Monthly rent: ₹25,000, payable by the 5th of each month by bank transfer. Rent shall be revised by not more than 7% on each renewal.” Rent & revision: Fix the amount, due date and mode (bank transfer creates proof). A clear revision clause prevents sudden, disputed hikes. Sudden mid-term increases without a contractual basis are generally not enforceable. “Security deposit: ₹50,000 (refundable), to be returned within 30 days of handover after lawful deductions.” Security deposit: State the amount, that it is refundable, the refund timeline, and the basis for deductions. Note: where the Model Tenancy Act is adopted, residential deposits are capped at two months’ rent — but that cap applies only in adopting states; many states have no statutory cap and rely on local practice. “Lock-in period: 6 months. Notice period for termination: 2 months in writing by either party.” Lock-in & notice: Lock-in means neither side can exit early without consequences. Notice period is how much warning is needed to end the tenancy. If the agreement is silent and no local law applies, Section 106 TPA default notice may apply (15 days for a month-to-month lease, expiring with the end of a month of the tenancy). “Society/maintenance charges: borne by Owner. Electricity, water (usage) and internet: borne by Tenant.” Maintenance & utilities: Spell out who pays society maintenance versus usage-based bills. This single clause prevents a very common dispute. “Repairs: structural and major repairs by Owner; minor/day-to-day repairs by Tenant. Tenant to maintain premises (reasonable wear and tear excepted).” Repairs: Allocate structural vs minor repairs clearly. The phrase “reasonable wear and tear excepted” tracks the tenant’s duty under Section 108 TPA to keep and restore the property in good condition, normal wear excepted. “Subletting: not permitted without prior written consent of the Owner.” Subletting: Most agreements prohibit subletting without written consent. Unauthorised subletting is a common ground for eviction. “Termination: on breach (e.g., non-payment beyond 2 months), the non-defaulting party may terminate after written notice and opportunity to cure…” Termination: Define the grounds and the process. Even with this clause, the landlord must use lawful means to recover possession — not force. “Dispute resolution: parties shall attempt amicable settlement; failing which, disputes are subject to the jurisdiction of courts/authorities at [city].” Dispute resolution: Naming the forum/jurisdiction (and arbitration, if any) saves time later. Where a state has adopted the Model Tenancy Act, certain disputes go to the Rent Authority/Court rather than civil courts. “Inventory: as per Annexure A (fixtures, appliances, condition), signed by both parties on handover.” Inventory list: A signed, dated inventory with photos is the strongest protection against deposit disputes. Do it at move-in and move-out. Section 3: Tenant Rights in India These rights are general principles drawn from the agreement, the Transfer of Property Act, and applicable state law. Their exact scope depends on your state and your contract. Right to peaceful possession (quiet enjoyment) A tenant lawfully in possession is entitled to use the premises without unlawful interference. Example: A landlord cannot simply change the lock while the tenant is at work because rent is delayed. The landlord must follow the legal process available under the agreement and applicable law. Right to privacy / against arbitrary entry Entry is generally governed by the agreement and usually requires reasonable notice and consent. Example: A landlord wanting to show the flat to prospective tenants should give advance notice and fix a mutually convenient time, not enter unannounced. Right to essential services Cutting off electricity or water to force a tenant out is generally treated as unlawful coercion, separate from the tenant’s own duty to pay genuine dues. Example: If a landlord disconnects the water supply to pressure the tenant to leave, the tenant can seek restoration; rent authorities and courts have ordered essential supply to be restored. Right to notice before lawful termination Lawful termination generally needs a valid ground and proper notice — under the agreement, the applicable state law, or Section 106 TPA where nothing else applies. Example: Where a month-to-month tenancy has no contrary term and Section 106 applies, a 15-day notice expiring with the end of a month of the tenancy may be required. Right to rent receipt / payment proof A tenant is entitled to proof of payment. Paying by bank transfer or insisting on receipts protects against false claims of arrears. Example: A tenant paying cash without receipts later struggles to disprove a landlord’s claim of non-payment. Bank records solve this. Right to deposit refund after lawful deductions The deposit must be returned after adjusting only genuine, justified dues (unpaid rent, real damage beyond normal wear, agreed charges). Example: If the flat is handed back clean and undamaged, the landlord generally cannot keep the deposit citing vague “cleaning” or “depreciation” without basis. Right against forceful dispossession Even a defaulting tenant cannot be physically thrown out. Indian courts have held that a person in settled possession may be evicted only through due process of law. Example: Using bouncers or removing the tenant’s belongings can expose the landlord to criminal complaints, regardless of the rent default. Section 4: Landlord Rights in India Right to receive rent on time Example: If rent is unpaid, the landlord can demand it in writing, maintain a ledger, and pursue lawful remedies — but cannot resort to self-help. Right to inspect the property with notice Example: A landlord may inspect for genuine maintenance reasons after giving reasonable advance notice and agreeing on a time. Right to recover damages Example: If a tenant breaks fixtures beyond normal wear and tear, the landlord may adjust the repair cost from the deposit with supporting evidence (photos, bills). Right to enforce agreement terms Example: If the agreement bars commercial use of a residential flat, the landlord can object and act on a breach. Right to object to illegal or unauthorised use Example: Using the premises for an unlawful activity is a serious breach the landlord can act upon. Right to prevent unauthorised subletting Example: If a tenant sublets rooms on a short-stay platform without consent, that can be a ground for eviction depending on the agreement and law. Right to seek eviction through lawful process Example: On valid grounds — such as non-payment for the period specified in the agreement or law — the landlord can pursue eviction before the appropriate court or rent authority. Section 5: Security Deposit Disputes Deposit fights are among the most common rental disputes. The principle is simple: the deposit secures the landlord against genuine loss, and the balance must be returned. When deductions may be valid: unpaid rent, genuine damage beyond normal wear and tear, agreed cleaning/repainting if contracted, and documented utility dues. When deductions may be illegal: arbitrary “depreciation,” normal wear and tear, or vague charges with no evidence or contractual basis. Damage vs normal wear and tear: A cracked basin or a burnt countertop is damage; minor wall fading or small nail holes are usually treated as normal wear. Move-in photos and a written inventory signed by both parties are the best evidence. Refund timelines depend on the agreement and state law (and on the deposit cap/refund rules where the Model Tenancy Act is adopted). Situation Can Deposit Be Deducted? Practical Note Unpaid rent Usually yes Keep a rent ledger / bank proof Broken fixtures Usually yes Evidence needed (photos, bills) Normal wall fading Disputed / often wear and tear Address in the agreement Cleaning charges Only if agreed or justified Avoid arbitrary deduction Utility dues Usually yes Attach the bills Security deposit “calculator-style” reference This is a worked illustration, not a legal entitlement. Suppose rent is ₹25,000 and the deposit is ₹50,000: Item Amount (illustrative) Basis required Deposit held ₹50,000 Agreement Less: 1 month unpaid rent – ₹25,000 Ledger / bank proof Less: broken geyser repair – ₹3,000 Bill + before/after photos Less: pending electricity dues – ₹1,200 Utility bill Refund due to tenant ₹20,800 Every deduction documented Rule of thumb: a landlord who cannot show a basis (bill, photo, ledger, or contract clause) for a deduction is on weak ground. A tenant who handed over a clean, documented flat is on strong ground. Section 6: Eviction Law Explained Eviction is where self-help causes the most damage. The lawful path differs by state and agreement, but the core principle is consistent: possession is taken back through legal process, not force. Landlord — avoid A landlord generally should not : throw out belongings, break locks, use bouncers, disconnect utilities, threaten the tenant, or force the tenant out without due process. Tenant — avoid A tenant generally should not : stop paying rent, overstay after lawful termination, damage the property, misuse rent-control protection, or sublet without permission. Lawful eviction — general flow Agreement breach Non-payment, unauthorised use, subletting, or expiry of term. Notice A proper written notice as per the agreement / applicable law / Section 106 TPA where it applies. Legal consultation Confirm the correct ground, forum and procedure for your state. Appropriate forum / court / rent authority File before the right body (civil court, rent controller, or Rent Court where the MTA is adopted). Order The forum decides on the merits and may pass an eviction order. Possession Possession is recovered lawfully, through the process — not by force. Section 7: Who Pays for Repairs? Repair responsibility depends heavily on the agreement. Under Section 108 of the Transfer of Property Act, in the absence of a contract to the contrary, broad defaults apply — but most disputes are decided by what the agreement says. The table below shows common practice; your contract controls. Issue Usually Landlord Usually Tenant Depends on Agreement Structural damage Yes No Sometimes Major plumbing Yes No Yes Minor tap leakage Sometimes Sometimes Yes Broken appliance by tenant No Yes Yes Painting Depends Depends Yes Society maintenance Depends Depends Yes Electricity bill No Yes Usually Property tax Usually landlord No Commercial leases may vary Section 8: Police Complaint or Civil Case? Most rent disputes are civil in nature — arrears, deposit refund, eviction, possession and agreement disputes are decided by courts or rent authorities, not by the police. Police may intervene where there are genuine criminal elements : criminal intimidation, trespass, assault, theft, cheating, forgery, or an illegal lockout. Non-payment of rent alone is usually civil unless the facts show criminal conduct. Filing false or exaggerated police complaints to gain leverage can backfire. Approach police when There are threats, violence, illegal lockout, stolen belongings, or forged documents. Approach civil / rent forum when The issue is eviction, arrears, deposit refund, possession, or an agreement dispute. Section 9: State-Wise Caution Box Because rent law is state-specific, the safest approach is to check the exact statute and local procedure that apply to your premises. The table lists what to verify — not fixed legal conclusions. State What To Check Maharashtra Applicable Rent Control Act, stamp duty, and registration (leave & licence registration practice) Delhi Rent Control protections and lease terms; what the agreement covers Karnataka State rent law plus agreement clauses Tamil Nadu State tenancy rules (Tamil Nadu has a dedicated tenancy regulation regime) Telangana Local registration/stamp requirements and applicable rent/eviction control law Gujarat Rent Act applicability to your premises West Bengal State premises tenancy law Uttar Pradesh Rent control / urban buildings regulation law Always verify the exact state law before acting. Whether and how the Model Tenancy Act, 2021 applies also depends on your state’s adoption status. Section 10: Practical Checklists Tenant checklist before moving in Verify the owner’s identity against government ID Verify ownership proof (or authority to let, e.g., POA for an NRI owner) Read the entire agreement, especially lock-in, notice, deposit and repairs Take dated property photos at move-in Record electricity, water and gas meter readings Clarify who handles which repairs Clarify the deposit refund timeline and deduction basis Insist on rent receipts or pay by bank transfer Avoid cash payments without proof Landlord checklist before giving the property Verify the tenant’s government ID Police verification where locally required Put everything in a written agreement Prepare a signed inventory list with photos Include a clear notice clause Include a clear subletting clause Include a clear deposit clause (amount, refund, deductions) Assign utility-bill responsibility in writing Include a damage / restoration clause Exit checklist (both parties) Serve / obtain written notice as per the agreement Take final meter readings together Take dated move-out photos Sign a handover memo recording condition and dues Settle the deposit with itemised, documented deductions Record the keys handover with proof (acknowledged in writing) Myth vs Reality Myth: “I own it, so I can throw the tenant out anytime.” Reality: Possession is protected from force. Recovery is through lawful process, even against a defaulting tenant. Myth: “Living here for years makes me the owner.” Reality: A tenant’s possession is on behalf of the landlord; long occupation alone does not create ownership. Myth: “A notarised agreement is the same as registered.” Reality: Notarisation ≠ registration. Certain leases require registration under the Registration Act, 1908. Myth: “The Model Tenancy Act applies all over India.” Reality: It is a model law; it applies only in states/UTs that adopt or notify it. Myth: “Cutting power forces the tenant out legally.” Reality: Disconnecting essential services as pressure is generally unlawful and can be reversed by authorities. Myth: “Police will evict my tenant for non-payment.” Reality: Non-payment is usually civil; police step in mainly for criminal conduct. Important Court Principles Only verified citations are included. Apply principles to your facts with a lawyer; outcomes are fact-specific. Case Court Year Principle (general) Krishna Ram Mahale (Dead) by LRs v. Mrs. Shobha Venkat Rao, (1989) 4 SCC 131 Supreme Court of India 1989 A person in settled possession of property cannot be dispossessed by the owner except by due process of law — self-help dispossession is impermissible. Additional precedents on essential services, deposit refunds and eviction grounds vary by state and statute. Case law should be verified and applied to your specific facts and jurisdiction before you rely on it. Landlord vs Tenant Rights — Comparison Question Landlord — general position Tenant — general position Recover possession Yes, on valid grounds via lawful process Protected from force; entitled to due process Entry into premises With reasonable notice/consent Right to privacy & quiet enjoyment Rent Right to receive on time Right to receipts / payment proof Essential services Cannot weaponise utilities Right to essential supply Security deposit Deduct genuine, documented dues Refund of the balance after lawful deductions Subletting Can prohibit / require consent Generally needs written permission “What Should I Do?” Scenario Cards Landlord changed my lock while I was out. Document it (photos, witnesses), send a written objection, and seek urgent legal advice. Illegal lockout may have civil and criminal dimensions. My tenant hasn’t paid rent for two months. Keep a ledger, send a written demand/notice as per the agreement, and consult a lawyer about the correct eviction forum for your state. Avoid self-help. My deposit isn’t being refunded. Send a written, itemised demand. If unresolved, consider the appropriate civil court, consumer forum, or rent authority based on facts and state. The landlord disconnected the water. Record evidence and seek restoration; rent authorities/courts have ordered essential supply restored. Keep paying genuine dues separately. The tenant sublet without asking. Check your agreement’s subletting clause; unauthorised subletting can be a ground for action. Proceed lawfully. I’m an NRI renting out my flat. Use a registered agreement where required, a clear POA for someone to manage it locally, bank-only rent, and a documented inventory. Downloadable Checklist Section Tip: Use your browser’s Print → Save as PDF to download this entire guide, including the three checklists in Section 10, for offline reference. The layout is print-friendly. Quick one-line essentials to keep handy: Written, properly executed agreement (registered where required) Signed inventory + move-in/move-out photos Bank-only rent with receipts Clear clauses: notice, lock-in, deposit, repairs, subletting Never use force; never weaponise utilities Verify your state law before acting Frequently Asked Questions 1. Can a landlord evict a tenant without notice? Generally no. Lawful termination usually needs a valid ground and notice — under the agreement, the applicable state law, or Section 106 of the Transfer of Property Act, 1882 where nothing else applies. Forcible eviction without due process is risky and can attract civil and criminal consequences. 2. Can a landlord enter the rented house anytime? Usually not without reasonable notice and consent. A tenant in lawful possession has a right to peaceful enjoyment and privacy. Entry rights are typically defined in the agreement. 3. Can a landlord disconnect electricity or water? Cutting essential services to force a tenant out is generally treated as unlawful coercion. Tenants can seek restoration, and authorities/courts have ordered essential supply to be restored. This is separate from the tenant’s duty to pay genuine utility dues. 4. Can a tenant refuse to vacate? A tenant cannot lawfully overstay after a valid termination, but the landlord still cannot use force. The landlord must use the appropriate legal forum. A tenant overstaying may face liability for mesne profits or enhanced occupation charges depending on the agreement and law. 5. Can a security deposit be withheld? A deposit may generally be adjusted against unpaid rent, genuine damage beyond normal wear and tear, or agreed dues — with evidence. Arbitrary retention can be challenged. Refund timelines depend on the agreement and state law. 6. Is a notarised rent agreement enough? Notarisation is not the same as registration. For leases that must be registered under the Registration Act, 1908, an unregistered or merely notarised document may not carry the same legal standing. Check your state’s stamp and registration rules. 7. Is a registered rent agreement compulsory? It depends on the term. Under Section 17 of the Registration Act, 1908, leases from year to year, for any term exceeding one year, or reserving a yearly rent require registration. Many agreements are made for 11 months partly for this reason, but state stamp duty and local practice still apply. 8. Who pays society maintenance? It depends on the agreement. Often the owner bears society maintenance while the tenant bears usage-based charges, but this varies — put it in writing. 9. Can a tenant sublet the property? Generally only with the landlord’s written consent. Many agreements and model frameworks prohibit subletting without permission; unauthorised subletting can be a ground for eviction. 10. Can a landlord increase rent suddenly? Rent revision is governed by the agreement and any applicable rent law. Sudden mid-term increases without a contractual basis are generally not enforceable. Some frameworks require advance written notice for revision. 11. What if a tenant stops paying rent? Non-payment is typically civil and a common ground for lawful eviction. Keep a rent ledger and follow the agreement and applicable law — not self-help. 12. What if a landlord refuses a deposit refund? Send a written, itemised demand. If unresolved, consider the appropriate civil court, consumer forum, or rent authority depending on the facts and your state. Documentation strengthens your claim. 13. Can police help in rent disputes? Most pure rent disputes are civil. Police may intervene where there are criminal elements such as intimidation, trespass, assault, theft, or illegal lockout. Non-payment of rent alone is usually civil. 14. What documents should a tenant keep? The signed agreement, rent receipts or bank records, move-in photos and meter readings, the inventory list, and all written communication with the landlord. 15. What documents should a landlord keep? The signed agreement, tenant ID and verification records where locally required, the inventory list, deposit and rent records, and a dated handover memo. 16. Does the Model Tenancy Act cap my security deposit? The Model Tenancy Act, 2021 caps residential deposits at two months’ rent and non-residential at six months’ rent — but only where a state/UT has adopted it. In states that have not adopted it, that cap does not automatically apply; check your state. Source Note & Final Disclaimer Primary legal sources cross-checked: Transfer of Property Act, 1882 — Sections 105–108 (leases, rights/liabilities) and Section 106 (notice for termination of certain leases, in the absence of contract/local law/usage). Registration Act, 1908 — Section 17 (registration of leases from year to year, exceeding one year, or reserving yearly rent). Indian Contract Act, 1872 — general law of agreements. Model Tenancy Act, 2021 — approved by the Union Cabinet on 2 June 2021 for adoption by states/UTs; deposit caps (2 months residential / 6 months non-residential) and the Rent Authority–Rent Court–Rent Tribunal mechanism apply only where adopted. (PRS Legislative Research; PIB.) State Rent Control / tenancy laws — state-specific; verify the statute applicable to your premises. Krishna Ram Mahale (Dead) by LRs v. Mrs. Shobha Venkat Rao, (1989) 4 SCC 131 — no dispossession of a person in settled possession except by due process of law. Because rental law is state-specific and fact-dependent, statements here use careful language (“generally,” “subject to agreement and state law,” “where applicable”). Verify the current law and your state’s adoption status before acting. Final legal disclaimer: This guide is for legal awareness and education only. Landlord-tenant law in India varies by state, property type, agreement terms, and facts. Please consult a qualified lawyer before taking legal action. © 2026 EduLaw · Last updated: 19 June 2026 · For educational use. (function(){ var faqs = document.querySelectorAll('.faq details'); faqs.forEach(function(d){ d.addEventListener('toggle', function(){ if(d.open){ faqs.forEach(function(o){ if(o !== d) o.open = false; }); } }); }); document.querySelectorAll('.toc a[href^="#"]').forEach(function(a){ a.addEventListener('click', function(e){ var t = document.querySelector(a.getAttribute('href')); if(t){ e.preventDefault(); t.scrollIntoView({behavior:'smooth', block:'start'}); } }); }); })();