0

I am new at Javascript, I am working on Chrome Extension now. This extension must provide to user ability to create Trello Board taking content (for Board name, members etc.) from the Vtiger CRM page.

Steps:

  1. Log in with Trello in Chrome Extension (done)
  2. Parse content from Vtiger CRM page
  3. Create Card

Now I can create Trello Card (without parsing CRM page) from settings.html page.

But when I trying to add link "Create Card" to popup.html, include popup.js to popup.html (contains script for handling click on the link), then I click to this link - nothing happens.

This is my first PR for this project: https://github.com/AnatolySt/chrome-roonyx/pull/1/files (contains oauth authorization via Trello and ability to create Card from settings page).

popup.html

<html>
<head>
    <meta charset="utf-8"/>
    <link rel="stylesheet" typ="text/css" href="css/style.css"/>
    <script src="scripts/jquery-2.1.1.js"></script>
    <script src="popup.js"></script>
</head>
<body>
    <div class="native">
        <h1>Chrome Roonyx</h1>
        <a id="trello_create_card" href="#">Create Card</a>
        <a id="sign-in-trello" href="/settings/index.html" target="_blank">Settings</a>
    </div>
</body>

popup.js (simple example for tests, popup.js was included in manifest.json)

function popup() {
    $("#trello_create_card").click(function () {
        console.log('You have clicked the link!');
    });
}

$(document).ready(popup);

Why nothing happens when I click to "Create Card" link in popup.html?

At first I want to make popup.js working successfully. Then I want to move functions from settings.js to popup.js for successfully creating cards from popup.html.

Could anybody explain me which steps I need to reproduce this functionality?

Sorry for my English. Thank you in advance!

Anatolii Stupin
  • 149
  • 1
  • 12

1 Answers1

-1

Looks like you forgot to include jQuery on popup.html. You can either include jQuery or change the popup.js to vanilla JS.

  • Sorry, I have already tried to add all scripts included in settings.html (including Jquery), but this does not help me. Now added Jquery. Problem is still here. – Anatolii Stupin Jun 25 '19 at 14:15