I have never paid much attention to javascript before, and the level of writing code is always half-baked. If you don't understand it, you can write something, and write something. There are often many vulnerabilities in writing :(
Recently, I am immersed in javascript. Especially in writing javascript code correctly and javascript performance.
Today, let's start with the simplest knowledge.
Generally, operations on the DOM structure or many other situations are written on the basis of jQuery, which leads to many times limited to the javascript framework, some native javascript methods or attributes are ignored.
Q1: How do I obtain the elements selected by the current mouse on the page?
A1: When jQuery is used, you should immediately think of several events it provides [focus (), focus (fn), focusin (fn), focusout (fn)]. You can use these methods to obtain the expected results. However, javascript itself provides a method, which is simpler: document. activeElement. id returns the id of the element with the current focus.
From the column of dripping water and stone