jQuery Modal Troubles

So, I’m trying to get a modal to work in jQuery. I originally wrote it in javascript, and I’m translating it to jQuery for learning purposes. When I write the following line of code, I think the console should return true, but it returns false. console.log($('#modal') == document.querySelector('#modal')); This is a roadblock for me in my jQuery, as I thought they were identical. Any advice would be appreciated. Thanks!
Here’s the pen:

But the jQuery-wrapped $("#modal") is NOT the same as the document.querySelector("#modal"). jQuery adds a lot of functionality. Instead, $("#modal")[0] should be the same.

console.log( ($("#modal")[0] == document.querySelector("#modal")))

The above line does, in fact, return true.

1 Like

$(’#modal’) is closer to querySelectorAll(’#modal’) in vanilla JavaScript, but still not exact.

@snowmonkey’s comment is spot on.

1 Like