Query TypeError: snackbarContainer is null












1















I got this error in my browser:




TypeError: snackbarContainer is null




If I click on my button, there is no action, just the browser error in my developer tool:



 <a onclick="buildAPK();"> <button type="button" class="btn btn-success btn-lg">APK Generieren</button></a> 


js code:



function buildAPK(){
$.post("build/build_apk.php", {
cmd: "build",
icon: $("#icon_for_build").val(),
packname: $("#packname_for_build").val(),
seller: $("#seller_for_build").val(),
appname: $("#appname_for_build").val(),
time: $("#time_for_build").val(),
ptitle: $("#ptitle_for_build").val(),
ptext: $("#ptext_for_build").val(),
ptime: $("#ptime_for_build").val(),
domain1: $("#domain1_for_build").val(),
domain2: $("#domain2_for_build").val(),
domain3: $("#domain3_for_build").val(),
domain4: $("#domain4_for_build").val(),
domain5: $("#domain5_for_build").val(),
welcomepage: $("#welcompage_for_build").val()
},
function(data, status){
var obj = jQuery.parseJSON(data);

//alert(obj.message);
var snackbarContainer = document.querySelector('#demo-toast-example');
var show_data = {message: obj.message};
snackbarContainer.MaterialSnackbar.showSnackbar(show_data);
});
}


Whats wrong with my code? Does anyone have an idea?



Full browser error:




TypeError: snackbarContainer is null[Learn More] scripts.js:785:4
buildAPK/< ............../js/scripts.js:785:4 i
............../js/vendor.bundle.base.js:2:28012
fireWith
............../js/vendor.bundle.base.js:2:28783
A
............../js/vendor.bundle.base.js:4:14033
c/<
............../js/vendor.bundle.base.js:4:16323



Source map error: request failed with status 404 Resource URL:
............../js/vendor.bundle.base.js Source
Map URL: bootstrap.min.js.map[Learn More]




#demo-toast-example exist in my Index Page



Url: /index.php?command=build



The first Button (buildAPK) is in the code from command=build file.



index.php



 <div id="demo-toast-example" class="mdl-js-snackbar mdl-snackbar">
<div class="mdl-snackbar__text"></div>
<button class="mdl-snackbar__action" type="button"></button>
</div>









share|improve this question

























  • It seems document.querySelector('#demo-toast-example') is not present in your scaffolding

    – Mosè Raguzzini
    Jan 2 at 16:56











  • Full Error code Updated.

    – berrymorre
    Jan 2 at 17:00











  • Yeah, so that's pretty self explanitory. The variable is null. So it's not being found by the selector you're using.

    – Taplar
    Jan 2 at 17:00











  • Can i bypass it or remove #demo-toast-example ? Or whats the solution for it:)

    – berrymorre
    Jan 2 at 17:02






  • 1





    Found the error:) i am an idiot :D i had opened the old index file where demo-toast-example not exist.. Thanks all for help:)

    – berrymorre
    Jan 2 at 17:22
















1















I got this error in my browser:




TypeError: snackbarContainer is null




If I click on my button, there is no action, just the browser error in my developer tool:



 <a onclick="buildAPK();"> <button type="button" class="btn btn-success btn-lg">APK Generieren</button></a> 


js code:



function buildAPK(){
$.post("build/build_apk.php", {
cmd: "build",
icon: $("#icon_for_build").val(),
packname: $("#packname_for_build").val(),
seller: $("#seller_for_build").val(),
appname: $("#appname_for_build").val(),
time: $("#time_for_build").val(),
ptitle: $("#ptitle_for_build").val(),
ptext: $("#ptext_for_build").val(),
ptime: $("#ptime_for_build").val(),
domain1: $("#domain1_for_build").val(),
domain2: $("#domain2_for_build").val(),
domain3: $("#domain3_for_build").val(),
domain4: $("#domain4_for_build").val(),
domain5: $("#domain5_for_build").val(),
welcomepage: $("#welcompage_for_build").val()
},
function(data, status){
var obj = jQuery.parseJSON(data);

//alert(obj.message);
var snackbarContainer = document.querySelector('#demo-toast-example');
var show_data = {message: obj.message};
snackbarContainer.MaterialSnackbar.showSnackbar(show_data);
});
}


Whats wrong with my code? Does anyone have an idea?



Full browser error:




TypeError: snackbarContainer is null[Learn More] scripts.js:785:4
buildAPK/< ............../js/scripts.js:785:4 i
............../js/vendor.bundle.base.js:2:28012
fireWith
............../js/vendor.bundle.base.js:2:28783
A
............../js/vendor.bundle.base.js:4:14033
c/<
............../js/vendor.bundle.base.js:4:16323



Source map error: request failed with status 404 Resource URL:
............../js/vendor.bundle.base.js Source
Map URL: bootstrap.min.js.map[Learn More]




#demo-toast-example exist in my Index Page



Url: /index.php?command=build



The first Button (buildAPK) is in the code from command=build file.



index.php



 <div id="demo-toast-example" class="mdl-js-snackbar mdl-snackbar">
<div class="mdl-snackbar__text"></div>
<button class="mdl-snackbar__action" type="button"></button>
</div>









share|improve this question

























  • It seems document.querySelector('#demo-toast-example') is not present in your scaffolding

    – Mosè Raguzzini
    Jan 2 at 16:56











  • Full Error code Updated.

    – berrymorre
    Jan 2 at 17:00











  • Yeah, so that's pretty self explanitory. The variable is null. So it's not being found by the selector you're using.

    – Taplar
    Jan 2 at 17:00











  • Can i bypass it or remove #demo-toast-example ? Or whats the solution for it:)

    – berrymorre
    Jan 2 at 17:02






  • 1





    Found the error:) i am an idiot :D i had opened the old index file where demo-toast-example not exist.. Thanks all for help:)

    – berrymorre
    Jan 2 at 17:22














1












1








1








I got this error in my browser:




TypeError: snackbarContainer is null




If I click on my button, there is no action, just the browser error in my developer tool:



 <a onclick="buildAPK();"> <button type="button" class="btn btn-success btn-lg">APK Generieren</button></a> 


js code:



function buildAPK(){
$.post("build/build_apk.php", {
cmd: "build",
icon: $("#icon_for_build").val(),
packname: $("#packname_for_build").val(),
seller: $("#seller_for_build").val(),
appname: $("#appname_for_build").val(),
time: $("#time_for_build").val(),
ptitle: $("#ptitle_for_build").val(),
ptext: $("#ptext_for_build").val(),
ptime: $("#ptime_for_build").val(),
domain1: $("#domain1_for_build").val(),
domain2: $("#domain2_for_build").val(),
domain3: $("#domain3_for_build").val(),
domain4: $("#domain4_for_build").val(),
domain5: $("#domain5_for_build").val(),
welcomepage: $("#welcompage_for_build").val()
},
function(data, status){
var obj = jQuery.parseJSON(data);

//alert(obj.message);
var snackbarContainer = document.querySelector('#demo-toast-example');
var show_data = {message: obj.message};
snackbarContainer.MaterialSnackbar.showSnackbar(show_data);
});
}


Whats wrong with my code? Does anyone have an idea?



Full browser error:




TypeError: snackbarContainer is null[Learn More] scripts.js:785:4
buildAPK/< ............../js/scripts.js:785:4 i
............../js/vendor.bundle.base.js:2:28012
fireWith
............../js/vendor.bundle.base.js:2:28783
A
............../js/vendor.bundle.base.js:4:14033
c/<
............../js/vendor.bundle.base.js:4:16323



Source map error: request failed with status 404 Resource URL:
............../js/vendor.bundle.base.js Source
Map URL: bootstrap.min.js.map[Learn More]




#demo-toast-example exist in my Index Page



Url: /index.php?command=build



The first Button (buildAPK) is in the code from command=build file.



index.php



 <div id="demo-toast-example" class="mdl-js-snackbar mdl-snackbar">
<div class="mdl-snackbar__text"></div>
<button class="mdl-snackbar__action" type="button"></button>
</div>









share|improve this question
















I got this error in my browser:




TypeError: snackbarContainer is null




If I click on my button, there is no action, just the browser error in my developer tool:



 <a onclick="buildAPK();"> <button type="button" class="btn btn-success btn-lg">APK Generieren</button></a> 


js code:



function buildAPK(){
$.post("build/build_apk.php", {
cmd: "build",
icon: $("#icon_for_build").val(),
packname: $("#packname_for_build").val(),
seller: $("#seller_for_build").val(),
appname: $("#appname_for_build").val(),
time: $("#time_for_build").val(),
ptitle: $("#ptitle_for_build").val(),
ptext: $("#ptext_for_build").val(),
ptime: $("#ptime_for_build").val(),
domain1: $("#domain1_for_build").val(),
domain2: $("#domain2_for_build").val(),
domain3: $("#domain3_for_build").val(),
domain4: $("#domain4_for_build").val(),
domain5: $("#domain5_for_build").val(),
welcomepage: $("#welcompage_for_build").val()
},
function(data, status){
var obj = jQuery.parseJSON(data);

//alert(obj.message);
var snackbarContainer = document.querySelector('#demo-toast-example');
var show_data = {message: obj.message};
snackbarContainer.MaterialSnackbar.showSnackbar(show_data);
});
}


Whats wrong with my code? Does anyone have an idea?



Full browser error:




TypeError: snackbarContainer is null[Learn More] scripts.js:785:4
buildAPK/< ............../js/scripts.js:785:4 i
............../js/vendor.bundle.base.js:2:28012
fireWith
............../js/vendor.bundle.base.js:2:28783
A
............../js/vendor.bundle.base.js:4:14033
c/<
............../js/vendor.bundle.base.js:4:16323



Source map error: request failed with status 404 Resource URL:
............../js/vendor.bundle.base.js Source
Map URL: bootstrap.min.js.map[Learn More]




#demo-toast-example exist in my Index Page



Url: /index.php?command=build



The first Button (buildAPK) is in the code from command=build file.



index.php



 <div id="demo-toast-example" class="mdl-js-snackbar mdl-snackbar">
<div class="mdl-snackbar__text"></div>
<button class="mdl-snackbar__action" type="button"></button>
</div>






javascript jquery






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 17:13







berrymorre

















asked Jan 2 at 16:53









berrymorreberrymorre

63




63













  • It seems document.querySelector('#demo-toast-example') is not present in your scaffolding

    – Mosè Raguzzini
    Jan 2 at 16:56











  • Full Error code Updated.

    – berrymorre
    Jan 2 at 17:00











  • Yeah, so that's pretty self explanitory. The variable is null. So it's not being found by the selector you're using.

    – Taplar
    Jan 2 at 17:00











  • Can i bypass it or remove #demo-toast-example ? Or whats the solution for it:)

    – berrymorre
    Jan 2 at 17:02






  • 1





    Found the error:) i am an idiot :D i had opened the old index file where demo-toast-example not exist.. Thanks all for help:)

    – berrymorre
    Jan 2 at 17:22



















  • It seems document.querySelector('#demo-toast-example') is not present in your scaffolding

    – Mosè Raguzzini
    Jan 2 at 16:56











  • Full Error code Updated.

    – berrymorre
    Jan 2 at 17:00











  • Yeah, so that's pretty self explanitory. The variable is null. So it's not being found by the selector you're using.

    – Taplar
    Jan 2 at 17:00











  • Can i bypass it or remove #demo-toast-example ? Or whats the solution for it:)

    – berrymorre
    Jan 2 at 17:02






  • 1





    Found the error:) i am an idiot :D i had opened the old index file where demo-toast-example not exist.. Thanks all for help:)

    – berrymorre
    Jan 2 at 17:22

















It seems document.querySelector('#demo-toast-example') is not present in your scaffolding

– Mosè Raguzzini
Jan 2 at 16:56





It seems document.querySelector('#demo-toast-example') is not present in your scaffolding

– Mosè Raguzzini
Jan 2 at 16:56













Full Error code Updated.

– berrymorre
Jan 2 at 17:00





Full Error code Updated.

– berrymorre
Jan 2 at 17:00













Yeah, so that's pretty self explanitory. The variable is null. So it's not being found by the selector you're using.

– Taplar
Jan 2 at 17:00





Yeah, so that's pretty self explanitory. The variable is null. So it's not being found by the selector you're using.

– Taplar
Jan 2 at 17:00













Can i bypass it or remove #demo-toast-example ? Or whats the solution for it:)

– berrymorre
Jan 2 at 17:02





Can i bypass it or remove #demo-toast-example ? Or whats the solution for it:)

– berrymorre
Jan 2 at 17:02




1




1





Found the error:) i am an idiot :D i had opened the old index file where demo-toast-example not exist.. Thanks all for help:)

– berrymorre
Jan 2 at 17:22





Found the error:) i am an idiot :D i had opened the old index file where demo-toast-example not exist.. Thanks all for help:)

– berrymorre
Jan 2 at 17:22












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54010192%2fquery-typeerror-snackbarcontainer-is-null%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54010192%2fquery-typeerror-snackbarcontainer-is-null%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

Npm cannot find a required file even through it is in the searched directory