未被捕获的ReferenceError:未定义$ / Chrome扩展程序未更新

时间:2020-10-27 20:22:05

标签: javascript google-chrome google-chrome-extension

目前,我正在尝试编写Chrome扩展程序开发指南。我是编程新手。扩展名应使用新值更新弹出窗口。有人知道我在这里做错了吗?

popup.html

<!DOCTYPE html>
<html>
<head>
    <title>Budget Manager</title>
    <script src="popup.js">        
    </script>
    <script src="jquery-3.5.1.min.js">
    </script> 
    <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <h1>Budget Manager</h1>
   <h2>Total Spent: <span id="total">0</span> </h2>
   <h2>Limit: <span id="limit"></span></h2>
   <h3>Enter Amount</h3>
    <input type="text" id="amount">
    <input type="submit" id="spendAmount" value="Spend">
</body>
</html>

popup.js

$(function(){
    $('#spendAmount').click(function(){
        chrome.storage.sync.get('total', function(budget){
            var newTotal =0;
            if(budget.total){
                newTotal += parseInt(budget.total);
            }
            var amaont = $('#amount').val();
            if(amount){
                newTotal += parseInt(amount);
            }
            chrome.storage.sync.set({'total': newTotal});

            $('#total').text(newTotal);
            $('#amount').val('');

        })
        $('#greet').text('Hello ' + $('#name').val());
    })
})

This error appears

0 个答案:

没有答案