i have a javascript function that is going to change the text of the element in the font tag when i click it. I am trying to get the element by its id tag with jquery but when i console.log the jquery result it comes up as undefined.
the all allWordsList variable is comming from python flask and i have confirmed that javascript is indeed receiving it properly
the problem seems to be with this line var wordID = $(el).attr("id");
because it returns undefined when i console.log it
<script type="text/javascript">
function changeText(el){
var allWordsList = JSON.parse({{listFontsJ|tojson|safe}});
console.log(allWordsList);
var wordID = $(el).attr("id");
console.log(wordID);
var display = document.getElementById(wordID);
display.innerHTML = '';
display.innerHTML = allWordsList[wordID]["english"];
}
</script>
<font id="1" size = '10' color = "red" onmousedown= "changeText()"> hello </font>