I came across the following in a piece of code:
var searchBox = $(this.element[0]);
I'm pretty new to Javascript and jQuery. I am trying to understand it but i am having a hard time. This line is in an implementation of jQuery UI Accordion widget.
What does the this
refer to?
Also, I played a bit with the line and I came to an understanding that it works perfectly - no matter what number is in the array. In addition, if I remove the brackets and just write the following line, it works just fine:
var searchBox = $(this.element);
What is it means and what is the difference?
Thank you very much. :)
Edit: Here is my full code. Maybe it could help. https://jsfiddle.net/yx8puo2j/1/