Sunday, May 6, 2018

JQ

Think I have found the entry point to what JQuery is up to. A powerful tool of Javascript
is the 'querySelector' method, which allows one to access any element by whatever
information we have about it: tag, id, class...But this also sets one up for quit a bit of wrangling
to get the element we want to do this or that. JQuery wants to simplify all that.

Below, I have taken a hide or show situation, as handled by JQuery, then redone it using
querySelector(). Jquery does make things easier, by creating a self-invoking function for
our element on the the action desired (it attaches the click event). One just fills in the blanks from
their template.



Adapted from W3 Schools.

No comments: