This is a very strange issue that is confusing me completely. I will paste the whole code just to make sure nothing is missed.
echo "
<script>
$(function() {
$('#biddingload').fadeOut(500);
function notice() {
$('#auction_notice').show();
$('#auction_notice').css('background', 'rgba(0, 100, 0, 0.8)');
$('#auction_notice').html('<p>bid accepted!</p>');
setTimeout(function() {
$('#auction_notice').fadeOut();
}, 1000); // <-- time in milliseconds
console.log('loaded notice');
}
// notice();
});
</script>
";
and right below that:
echo "
<script>
$(function() {
notice();
});
</script>
";
this returns Uncaught ReferenceError: notice is not defined
if I run notice() in the above (commented) part, it works. How this makes sense?
Ok, let me rephrase a question - how is this ($(function() {) a different scope? What would be the right code to call this function afterwards?