The following selector $('.sub_menu_container',this)
has 2 parameters, the selector you want to search for and a second one. In this case its this
. What is the use of adding that second parameter? Ive search the jquery docs but didnt find anything that could help me. Is it some kind of reference?
the second param provides the context in which to search the element matched by the first selector
its just like :
$(this).find('.sub_menu_container')
its a context re-format of code.
that all :)
The second parameter scopes the selector, so that it only searches inside the context of the element provided in the second parameter. It is basically the same as saying $(this).find('.sub_menu_container');
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With