Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
Edit text using js in a Chrome extension using designmode not working

I am trying to edit text using js in a Chrome extension using designmode not working. It works in the console but here is there any additional change I need to make to make this work for the Chrome extension

all the code below - manifest.json --

{
"manifest_version" : 2,
"name" : "changer",
"version" : "1.0",
"description" : "chnage it",
"icons" : {
    "128" : "icon_128.png",
    "16" : "icon.png"
},
"browser_action" : {
    "default_icon" : "icon.png",
    "default_popup" : "popup.html"
},
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
}

js code -

document.getElementById("btn").addEventListener("click", change);
document.getElementById("btnclose").addEventListener("click", close);

function change (){
    document.designMode = 'on'
}

function close (){
    document.designMode = 'off'
}

html -

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Document</title>
</head>
<body>
    <div class="main">
        <div class="heading">
            Change text on the web 
        </div>
        <div class="button">
            <button id="btn">Turn ON</button>
            
            <button id="btnclose">Turn OFF</button>
        </div>
    </div>
</body>
<script src="script.js"></script>
</html>

I am trying to edit the text on the web but it is not working it works in the console I also tried

document.contentEditable=true

but it also didn't work

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!