0
I did a search and could not find anything about (probably because I’m not sure how to search). Anyway, someone there knows?
NOTE: I don’t want to know the difference between . click and . on('click'), please read the two options carefully. What I want to know is the difference of referencing the element that will receive the action before saying what the action or after (putting Document in the place that before was the element).
$('.botao').on('click')
and $(document).on('click', '.botao')
What you understood from documentation where it deals with the second function parameter?
– Woss
Diego is not the same question, I had seen this question already, her doubt is the difference between . click and on. ('click'). My question is about the difference of putting $(Document) in place of the element that receives the action, and referencing the element afterwards. If you notice the two calls in my question use the . on('click')..
– Thavi Lang
Hi Thavi, the difference in this case would be that '$('.botao')' Voce is only doing an action in this class, recommended use for when you want to add an action in a specific element. Already the '$(Document). on('click', '.boot')' you are executing the action throughout the page in case there is more than one element with the class put in the page and when it is clicked this action will be triggered. Document = pages.extensao window = page loaded . button (only) = element identifier.
– Eduardo