在 div 上调用 .jSignature() 不会更新 div

Calling .jSignature() on div doesn't update the div

我从 GitHub 获得了这段代码:

<script src="path/to/jSignature.min.js"></script>

<script>
    $(document).ready(function() {
        $("#signature").jSignature()
    })
</script>

<div id="signature"></div>

但它不会在实际网页上提取任何内容。我认为需要更多代码,但我不知道从哪里开始。

这是一个最小的工作示例

<!DOCTYPE html>
<html lang="en">
    <head>
        <lang>
        <title>Minimal working jSignature Example</title>
        <meta charset="UTF-8">
        <!-- Files from the origin -->
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <script src="https://willowsystems.github.io/jSignature/js/libs/jSignature.min.js"></script>
    <head>
    <script>
    $(document).ready(function() {
        // Initialize jSignature
        $("#signature").jSignature();
    })
    // ripped from the description at their the Github page
    function getBase64Sig(){
         // get the element where the signature have been put
         var $sigdiv = $("#signature");
         // get a base64 URL for a SVG picture
         var data = $sigdiv.jSignature("getData", "svgbase64");
         // build the image...
         var i = new Image();
         i.src = "data:" + data[0] + "," + data[1];
         // and put it somewhere where the sun shines brightly upon it.
         $(i).appendTo($("#output"));
    }
    </script>
    <body>
        Put your signature here:
        <div id="signature"></div>
        <button onclick="getBase64Sig()">Get Base64</button>
        <div id="output"></div>
    </body>
</html>

希望你能从这里继续下去。

确实像他们描述的那样简单,只是他们对实际例子的描述对初学者来说有点欠缺。