0

次の問題、ギャラリーを動的に設定する必要があります。だから私はクラス .gallery を見つけて、いくつかの html コードを追加したいと思います。私の解決策は次のとおりです$(".gallery").append('<div class="row">');。奇妙な部分は、jqueryがこのセレクターを見つける場合とそうでない場合があることです。すでに含めまし$( document ).ready(function() {たが、何も変わりませんでした。これを解決する方法はありますか?

私が得ているエラー: `

TypeError: $(...).html(...) is undefined
Stack-Trace:
setImages/</<@http://localhost:3000/app/app.js?hash=1ff5b02af1c2e6f71af9355d997116d10d0ba91f:342:36
require<.node_modules.meteor.jquery["jquery.js"]/</jQuery.Callbacks/fire@http://localhost:3000/packages/jquery.js?hash=22a0055f59bd150c435c5aba34c7c59076b8bcd9:3201:10
require<.node_modules.meteor.jquery["jquery.js"]/</jQuery.Callbacks/self.add@http://localhost:3000/packages/jquery.js?hash=22a0055f59bd150c435c5aba34c7c59076b8bcd9:3247:7
require<.node_modules.meteor.jquery["jquery.js"]/</jQuery.fn.ready@http://localhost:3000/packages/jquery.js?hash=22a0055f59bd150c435c5aba34c7c59076b8bcd9:3481:2
setImages/<@http://localhost:3000/app/app.js?hash=1ff5b02af1c2e6f71af9355d997116d10d0ba91f:330:21
Tracker.Computation.prototype._compute@http://localhost:3000/packages/tracker.js?hash=6f5d0f5486aaa54b0abe636174eeb06dcc2a736b:351:5
Tracker.Computation@http://localhost:3000/packages/tracker.js?hash=6f5d0f5486aaa54b0abe636174eeb06dcc2a736b:239:5
Tracker.autorun@http://localhost:3000/packages/tracker.js?hash=6f5d0f5486aaa54b0abe636174eeb06dcc2a736b:590:11
setImages@http://localhost:3000/app/app.js?hash=1ff5b02af1c2e6f71af9355d997116d10d0ba91f:328:13
bindDataContext/<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2994:14
Blaze._wrapCatchingExceptions/<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1653:14
wrapHelper/</<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3046:14
Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3687:12
wrapHelper/<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3045:12
Spacebars.call@http://localhost:3000/packages/spacebars.js?hash=65db8b6a8e3fca189b416de702967b1cb83d57d5:172:12
Spacebars.mustacheImpl@http://localhost:3000/packages/spacebars.js?hash=65db8b6a8e3fca189b416de702967b1cb83d57d5:106:10
Spacebars.mustache@http://localhost:3000/packages/spacebars.js?hash=65db8b6a8e3fca189b416de702967b1cb83d57d5:110:16
require<.client.Website.Vorlagen["template.vorlageBlogArtikel.js"]/Template.vorlageBlogArtikel</</<@http://localhost:3000/app/app.js?hash=1ff5b02af1c2e6f71af9355d997116d10d0ba91f:137:14
doRender@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2027:20
viewAutorun/</<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1875:18
Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3687:12
viewAutorun/<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1873:14
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2214:12
viewAutorun@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1872:12
Tracker.Computation.prototype._compute@http://localhost:3000/packages/tracker.js?hash=6f5d0f5486aaa54b0abe636174eeb06dcc2a736b:351:5
Tracker.Computation@http://localhost:3000/packages/tracker.js?hash=6f5d0f5486aaa54b0abe636174eeb06dcc2a736b:239:5
Tracker.autorun@http://localhost:3000/packages/tracker.js?hash=6f5d0f5486aaa54b0abe636174eeb06dcc2a736b:590:11
Blaze.View.prototype.autorun@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1885:14
Blaze._materializeView/<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2021:5
Tracker.nonreactive@http://localhost:3000/packages/tracker.js?hash=6f5d0f5486aaa54b0abe636174eeb06dcc2a736b:617:12
Blaze._materializeView@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2020:3
materializeDOMInner@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1476:9
Blaze._materializeDOM@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1418:3
Blaze._materializeDOM@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1427:7
doMaterialize@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2033:32
Tracker.nonreactive@http://localhost:3000/packages/tracker.js?hash=6f5d0f5486aaa54b0abe636174eeb06dcc2a736b:617:12
doRender@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2031:9
viewAutorun/</<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1875:18
Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:3687:12
viewAutorun/<@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1873:14
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:2214:12
viewAutorun@http://localhost:3000/packages/blaze.js?hash=ef41aed769a8945fc99ac4954e8c9ec157a88cea:1872:12
Tracker.Computation.prototype._compute@http://localhost:3000/packages/tracker.js?hash=6f5d0f5486aaa54b0abe636174eeb06dcc2a736b:351:5
Tracker.Computation.prototype._recompute@http://localhost:3000/packages/tracker.js?hash=6f5d0f5486aaa54b0abe636174eeb06dcc2a736b:370:9
Tracker._runFlush@http://localhost:3000/packages/tracker.js?hash=6f5d0f5486aaa54b0abe636174eeb06dcc2a736b:509:9
onGlobalMessage@http://localhost:3000/packages/meteor.js?hash=ae8b8affa9680bf9720bd8f7fa112f13a62f71c3:401:11
EventListener.handleEvent*usePostMessage@http://localhost:3000/packages/meteor.js?hash=ae8b8affa9680bf9720bd8f7fa112f13a62f71c3:410:5
@http://localhost:3000/packages/meteor.js?hash=ae8b8affa9680bf9720bd8f7fa112f13a62f71c3:439:3
@http://localhost:3000/packages/meteor.js?hash=ae8b8affa9680bf9720bd8f7fa112f13a62f71c3:292:2
@http://localhost:3000/packages/meteor.js?hash=ae8b8affa9680bf9720bd8f7fa112f13a62f71c3:11:2

私が実行しているコードの一部:

Tracker.autorun(function() {
            if (Session.get("bereit")){
                $( document ).ready(function() {
                    var knoten = document.getElementsByClassName("gallery");
                    console.log(knoten);
                    $(".gallery").append('<div class="row">');
                    console.log("i was here")
                    var item = $('.gallery');
                    console.log(item.length);       
                })
            }
    })

はい、すべてのセッションとサブスクリプションの準備ができているので、私にとっては「jqueryの問題」のようです

4

0 に答える 0