Weird error in my jQuery

Hi guys,

I have e weird error in my console. Does anyone know what’s wrong with my code?



Fairly new so cant tell you what the problem is but have run it through developer tools debug and you have a problem with the line .appendTo(this) in your function below … this jumps into the jQuery code and gets a error and fails. So until someone with more experience has a look … have a look at your function below … and debug and try and fix it. if you sort that out you might be back on track.
close: function() {
var $this = $(this);
.on(‘click’, function() {

Hey, I fixed your code a bit. this is a working version of your code. I have placed comments where I changed something. If you open both the working version and your version side by side the comments will, hopefully, make sense. It were all minor things or “weird” jQuery behaviour. I liked the fact that you used an object to do this!

Hi Ben, it was you who told me to follow Jeffrey Wey’s course 30 days to learn jQuery. This code comes from this course. It was a great advice! I’m learning so much!

And thank you for your comments! You’ve helped me a lot.

1 Like

Hi JohnL3, what browser do you use? Thanks for finding the weak spot!

I use chrome and am forever debugging as stepping through the code makes life easier … glad to see you got some help sorting things out.