I've been working on this external jQuery code:
jQuery(document).one('keydown', 'g',function (evt){
if ($("#tb").html() == "0")
{
$("#tb").html("Testing the chicken.")
} else {$("#tb").html("Chickens fart too.")}
return false;});
No errors are showing in the console.
I know it might seem a bit silly, but I'm not concerned about the text inside .html(). Every time I visit the webpage, the default 0 gets replaced with nothing. Then, when I press any key, nothing seems to happen. Ultimately, my goal is for this script to display the letter or number that the user types in the tb
div.
P.S. This is my first time using stackoverflow, so please let me know if my formatting is incorrect or if I've broken a rule.
So, I made some edits to the code and here's what I came up with:
$('#tb').on("keydown", function(event) {
if ($("#tb").html() == "0")
{
$("#tb").html("Testing the chicken.")
} else {$("#tb").html("Chickens fart too.")}
});
Despite the changes, it still doesn't seem to be functioning as expected.