I'm having issues with onclick, specifically the onclick="Foo()" seen in the code below. When clicked, I'm getting undefined, yet I have included the function at the top and even out of the function.
$( document ).ready(function() {
function Foo() {
console.log('clicky click click');
document.getElementById('categoryBubble').style.display = 'none';
}
$('.mutliSelect select').on('change', function() {
var title = $(this).closest('.mutliSelect').find('option').val();
title = $(this).val() + "";
if ($(this).is(':selected')) {
// the code for if goes here
} else {
console.log('im working here #2');
var html = '<span id="categoryBubble" title="' + title + '">' + title + '</span>' + '<span onclick="Foo()" class="Xout">x</span>';
$('.multiSel').append(html);
$(".hida").hide();
}
});
});