The button is malfunctioning and adjust the border hue

I've been experimenting with creating a Firefox Extension, but I'm struggling to get the button in the popup to work as intended. The desired functionality is for the red border to change to green when the button is clicked, but I can't seem to locate the mistake in my code.

Here's a snippet from my manifest.json file:


    {
        "manifest_version": 2,
        "name": "Testing",
        "version": "1.0",
        "description": "Testing",
    
        "icons": {
            "48": "icon.jpg"
        },
    
        "content_scripts": [
            {
                "matches": ["*://*.allee-abi20.de/*"],
                "js": ["ust.js"]
            }
        ],
        
        "permissions": [
            "activeTab",
            "contextMenus"
        ],
        
        "browser_action": {
            "default_icon": "icon.jpg",
            "default_title": "Hello",
            "default_popup": "view.html"
        }
    }
    

Here's the code snippet from view.html:


    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8"/>
            <link rel="stylesheet" href="style.css" type="text/css"/> 
        </head>
        <body>
            <input type="text" id="Kat"></input>
            <input type="text" id="Ty"></input>
            <button id="but">Click</button>     
            <script type="text/javascript" src="./popup.js"></script>   
        </body>
    </html>
    

And here's the snippet from popup.js:


    document.body.style.border = "5px solid red";
    var myLink = document.getElementById("but");
    myLink.onclick = function(){
        document.body.style.border = "20px solid green";
    }
    

Answer №1

A small syntax problem was found with uppercase letters: be sure to use but instead of But, as But is not defined.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Encountering an Error while Setting Up NextJS on Vercel

Hello, I'm a newcomer to the world of web development. My current goal is to deploy my first NextJS app on Vercel, but I keep encountering an error. Error: SyntaxError: Unexpected token T in JSON at position 0 at JSON.parse (<anonymous>) ...

What is preventing Angular from loading on this Plnkr?

I've spent time researching my problem and testing various solutions, but I still can't seem to resolve it. Angular doesn't appear to be loading correctly in Plunker for some reason. I've heard that ng-app is no longer supported in ne ...

Enhanced approach to building with React and Express

Quick Summary: How can I set up a project using React on the front-end and Express on the back-end with just one package.json and node_modules folder? When starting a project that combines a React front-end and an Express back-end, my desired structure is ...

I am experiencing an issue where the Ajax/Javascript functionality is unresponsive on my homepage

I have been attempting to design a button using a simple Ajax / Javascript command. It seems to be functioning properly, but I am encountering an issue where it does not appear on the main page when inspecting with F12, causing some complications. Below i ...

The hyperlinks on the webpage are not functioning

I am encountering an issue with a link on a particular page. When scrolling down, the link works perfectly; however, when I attempt to scroll up, it remains in the same position. Here is a snippet of the code: (function($){ /* Store the original positions ...

extracting data from a javascript array

While facing an issue with scraping a website , I received helpful solutions from Fatherstorm and marcog. Despite the great solution provided by Fatherstorm, there were some minor bugs related to start time and the number of image sources being retrieved a ...

Integrating Facebook login with Cordova using the cordovaOauth plugin

Encountering issues while setting up FB login for my cordova mobile app. A tutorial followed: http://www.codeproject.com/Tips/1031475/How-to-Integrate-Facebook-Login-into-a-Cordova-App#_comments <script src="js/angular.js"></script> <scrip ...

Different Types of Forms on a Single Webpage Using AJAX

I'm struggling to get multiple forms to work on the same page. No matter what I try, it always submits the first form. The goal is to identify each form uniquely so that only the specific one is submitted. The current code below achieves this but alw ...

Is it appropriate to include a function within a loop?

I'm curious to know if it's considered good practice to call a function inside a loop. Both of the following code snippets produce the same result, but I want to add clarity by using a function. Is this considered good practice? Thank you. Code ...

Brochure displaying shattered tiles using ionic

Whenever I try to load a map using Ionic, it keeps displaying broken tiles. No matter if I load directly from Leaflet or use bower, the issue persists. Even when using pure leaflet code without any special directives, those broken tiles are still there. ...

In what ways can you toggle the visibility of table rows and data dynamically with the onchange event in HTML?

I'm dealing with an HTML code that can dynamically change table data based on user selection. Here's the snippet of my HTML code: Select an option: <select name='set' id="set" class="selectpicker" onchange='displayFields(this. ...

Align the number of an Unordered List to the left

Exploring UN-ordered lists in HTML has led me to wonder if it's possible for dynamically generated ul tags to display like this: * Hello * Hi * Bi * Name * Ron * Mat * Cloth * Color * Red When I ...

Increasing and decreasing values

I'd like to create two buttons for increasing and decreasing a value. For example, if the variable k is initially set to 4 and I press the decrement button, it should decrease from 4 to 3. This is what I attempted: var k = 1; function qtrFunction ...

Issue with updating Angular list reference when deleting an item

My current task involves implementing a feature that displays selected items from a hierarchical structure on the right side. slice.component.ts : import { Component, Input, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core&a ...

Creating a tree-view in Vue.js that includes clickable components which trigger a Vue.js modal to open up

I have a unique requirement to implement a tree-view feature in Vue-JS for displaying JSON data. However, I need to enhance this by triggering a VueJS modal when any of the data fields in the JSON view are clicked. I have explored various npm modules that ...

Discover the specific item within an array of objects

Anyone have information like this: const info = { Title : "Banana", Quantity : 10, Location : "Everywhere", Phone : 123456, A : 987, B : 654, } and there is another array of details as: const dataArr = ["Title",&q ...

The Google Pie chart is displaying outside of the designated div area when placed inside a dropdown menu

Encountering an issue with my pie chart rendering outside of its parent div when placed within a dropdown menu. The chart successfully loads after the page is loaded, but only displays correctly if I hover over the dropdown and allow it to load. If I do ...

-g option must be enabled for jscoverage to function properly

To install jscoverage globally, use the following command: npm install jscoverage -g Do you know what purpose the -g option serves? Without using the -g option, my system does not recognize jscoverage as a valid command. ...

When attempting to add a variable using the next() function, I encountered an error with the BehaviorSubject. The error message displayed was "this.count.next is not a function"

In my Angular service, there is a variable called count that I need to monitor for updates. Whenever this count variable is updated, I want to assign its new value to another variable in a separate component. import {BehaviorSubject} from "rxjs/BehaviorSu ...

PHP issues caused by Ajax form compatibility

I'm currently working on developing an upload website and I've encountered some challenges while trying to implement an upload progress bar. The Ajax form in my scripts seems to be causing issues with the PHP code, preventing the file from being ...