Home > Article > Web Front-end > Implementation ideas for this object passed through href and onclick in A tag_javascript skills
In the backend management of the blog, it is allowed to add an address to a category, but it is not easy to add an onclick event. I wanted to pass the current object to a function, so I wrote the URL as "Javascript:shoControlSidebar(this)", but it turned out that this was not feasible. The parameter passed was an object, but no other information was obtained. What I want to get is innerText, and this this does not point to the A tag where it is located.
This is the difference between and .
When using onclick="shoControlSidebar(this)", the interpreter will wrap it with an anonymous function, which becomes: