0

私はこのJqueryライブラリgraphdraculaで作業しており、私はこのビューを持っています:

見る

html コードコード

 <script>
         $.fn.changeElementType = function (newType) {
             var attrs = {};

             $.each(this[0].attributes, function (idx, attr) {
                 attrs[attr.nodeName] = attr.nodeValue;
             });

             this.replaceWith(function () {
                 return $("<" + newType + "/>", attrs).append($(this).contents());
             });
         };
</script>
<script type="text/javascript">
    $(function () {
        $("#canvas").changeElementType("a");
        // Now you probably want to add an href
        $('a').attr('href', 'http://www.google.com');
    });
    </script>

divホール要素ではなく、タイトル (F2、la fonction une...) のみを選択したいと思います。私は試した:

$("text").changeElementType("a");

$("tspan").changeElementType("a");

しかし、私はこのビュー(グラフなし)を持っていました。

エラー

では、このエラーの理由は何ですか? ラベルを選択してハイパーテキスト リンクに変更するようにコードを修正するにはどうすればよいですか?

4

1 に答える 1